Skip to content

@nuxt/scripts: MarkerClusterer import error when building - missing @googlemaps/markerclusterer dependency #550

@narr07

Description

@narr07

🐛 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

  1. 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions