🐛 The bug
When building the project with @nuxt/scripts@0.13.0, the build process fails with an error:
"MarkerClusterer" is not exported by "__vite-optional-peer-dep:@googlemaps/markerclusterer:@nuxt/scripts:false", imported by "node_modules/@nuxt/scripts/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue".
The build fails even though we're not using the GoogleMaps MarkerClusterer component in our project. The optional peer dependency should not cause a build failure.
🛠️ To reproduce
- Create a Nuxt 4 project with @nuxt/scripts@0.13.0 2. Do not install @googlemaps/markerclusterer as it's not used in the project 3. Run
npm run build or bun run build
🌈 Expected behavior
Error: [nuxi] Nuxt Build Error: node_modules/@nuxt/scripts/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue (4:9): "MarkerClusterer" is not exported by "__vite-optional-peer-dep:@googlemaps/markerclusterer:@nuxt/scripts:false", imported by "node_modules/@nuxt/scripts/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue".
ℹ️ Additional context
Environment:
- @nuxt/scripts: 0.13.0
- Nuxt: 4.2.0
- Package manager: bun