I'm using Create react app to bootstrap my React JS application. I have integrated Mapbox GL via react-mapbox-gl
.
My package.json has these two dependencies for mapbox (other dependencies were omitted):
"dependencies": {
"mapbox-gl": "^0.38.0",
"react-mapbox-gl": "^1.12.0",
}
Mapbox works as expected on localhost:3000
but not in my production build on localhost:8000
. I use npm run start
to build my project.
Here is what it looks like in 8000 production: mapbox not working
Here is what it looks like in 3000 development: expected map
The error I get exactly 9 times is:
Uncaught ReferenceError: e is not defined
React-mapbox-gl version 2.* should work with create-react-app. You can have a look at react-mapbox-gl-debug which is a boilerplate using create-react-app for react-mapbox-gl.