Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation is unclear about the installation of @mapbox/mapbox-gl-geocoder #139

Open
michaelklopf opened this issue Apr 22, 2024 · 1 comment

Comments

@michaelklopf
Copy link
Contributor

I get the following error, when I install the package without the @mapbox/mapbox-gl-geocoder.

✘ [ERROR] Could not resolve "@mapbox/mapbox-gl-geocoder"

    ../../node_modules/@studiometa/vue-mapbox-gl/index.js:580:27:
      580 │ import MapboxGeocoder from "@mapbox/mapbox-gl-geocoder";~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@mapbox/mapbox-gl-geocoder" as external to exclude it from the bundle,
  which will remove this error.

The documentation suggests the installation is optional, see here https://vue-mapbox-gl.studiometa.dev/guide/installation/

# The geocoder package is only required if you use the `MapboxGeocoder` component
npm install @mapbox/mapbox-gl-geocoder

The code does require the package though. So who is correct?

@titouanmathis
Copy link
Collaborator

The package is indeed always imported, this was a mistake. I am not sure how to fix this without introducing a breaking change.

We could either pass the MapboxGeocoder as a prop of the component, letting the user decide which version of the package to use, or move the component to a dedicated import path like @studiometa/vue-mapbox-gl/geocoder.

I'll think about it.

In the meantime, you could mark the package as external as your bundler is suggesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants