Closed kevinjmo closed 1 year ago
Not sure what you did exactly when you say "remove mapbox-gl and replace it with maplibre-gl". My guess is you are still importing something from react-map-gl
not react-map-gl/maplibre
.
Not sure what you did exactly when you say "remove mapbox-gl and replace it with maplibre-gl".
What I meant is that instead of using the mapbox-gl as the mapLib, I am switching to use maplibre-gl.
My guess is you are still importing something from
react-map-gl
notreact-map-gl/maplibre
.
That is incorrect. I am importing from react-map-gl/maplibre.
In my issue description, I mentioned that this error throws at the bundle step with Webpack. I believe that the ESM export from react-map-gl is not properly configured in v7.1 so we still have to install a placeholder mapbox-gl as a dependency or set config.externals = ['mapbox-gl']
.
I suggest you create a repo that reproduces your issue. You can use https://github.com/visgl/react-map-gl/tree/master/examples/get-started/maplibre as a starting point.
My apologies, @Pessimistress – you are right; I didn’t realize I also had to update my other imports (eg. Marker, Source, useMap, etc.) to also import from react-map-gl/maplibre
instead.
Once I updated those imports, it’s working perfectly.
Thank you again for your help and patience! I really appreciate all the work and time you put into this project :)
Description
I’ve been using react-map-gl with mapbox-gl and recently, I switched to use maplibre-gl instead. When removing mapbox-gl from the package.json and doing a clean install (while generating a clean package-lock.json), I get the following error
This happens even when using 7.2.0-beta.1. However, if I keep my old package-lock.json and just do a
npm uninstall mapbox-gl
then it seems to work as the oldmapbox-gl
dependency is still in the package-lock.json.It seems to be fixed when doing the previous
npm:empty-npm-package@^1.0.0
placeholder, but the upgrade guide for 7.1 suggests that it should not be needed anymore.Expected Behavior
It should work without needing the placeholder or adding
config.externals = ['mapbox-gl']
to the webpack config.Steps to Reproduce
Environment
Logs
No response