react-map-gl keeps asking for mapbox-gl #1773
Unanswered
victcebesp
asked this question in
Q&A
Replies: 2 comments 3 replies
-
What I think is happening is that on this line it is not recognizing the mapLib prop that I am supposly sending when instantiating the Map component from react-map-gl. Am I missing something? Thanks! |
Beta Was this translation helpful? Give feedback.
2 replies
-
If you're using NextJS, add the following webpack configuration to your const nextConfig = {
// route every mapbox-gl import to maplibre-gl
webpack: config => {
config.resolve.alias['mapbox-gl'] = 'maplibre-gl'
return config
},
}
module.exports = nextConfig Credits: I found this solution in the maplibre-nextjs-ts-starter repo from @richard-unterberg |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys!
Today I tried to change from using mapbox-gl to use maplibre-gl and to do that I followed this tutorial. To be more precise, I removed the mapbox-gl dependency from my package.json and added maplibre-gl v2 to it. In addition, I passed maplibre to the Map component using the mapLib prop. After doing that, I run yarn install and once everything was installed, I run yarn start to launch the project again.
Once the project started, the following error prompted on screen:
./node_modules/react-map-gl/dist/esm/components/map.js Module not found: Can't resolve 'mapbox-gl' in '{MY_PATH}/node_modules/react-map-gl/dist/esm/components'
It looks like reat-map-gl is still looking for mapbox-gl. What am I missing?
Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions