-
Notifications
You must be signed in to change notification settings - Fork 535
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
Uncaught ReferenceError: y is not defined #931
Comments
Workaround from here mapbox/mapbox-gl-js#10173 (comment) Install
|
Can you share more details about this workaround?
but it doesn't compile well. Fails with Module not found: Can't resolve 'worker-loader' in |
@Slava-fe-mjstk I faced the same issue and realized that it is "worker-loader" that needs to be used instead of "webpack-loader". Try I will say that even with the Maybe there is something else I'm missing in my implementation @ttrubel ? Code Implementation --> https://github.com/reMRKableDev/dance-specific-talks/blob/master/src/components/Map/configs/index.js Live App --> https://ds-talks.netlify.app/map |
@Slava-fe-mjstk I was wrong, shame on me :) it's a worker-loader, not webpack-loader @reMRKableDev I see the app is working, hope you figured out it |
@ttrubel I ended up using react-leaflet instead to fix the issue. I'm closing the issue on here since I can't seem to figure out a way around it. Thanks for everything so far though |
@ttrubel It worked for me. Thanks |
I would close this issue since the aformentioned webpack-loader stuff seems to work (at least for most). This issue is upstream and is due to mapbox switching to ES6 bundle: mapbox/mapbox-gl-js#10173 |
I encounter the issue, too. I solved it with craco without changing source code. First, install craco Then, create module.exports = {
babel: {
loaderOptions: {
ignore: ["./node_modules/mapbox-gl/dist/mapbox-gl.js"],
},
},
}; |
It works like a charm! Thank you @doraeric!! |
I'm having the same issue, but this isn't working for me :( |
@Fredrikwide the craco fix doesn't work for me either. @Fredrikwide did you find anything? |
This may help? |
module.exports = {
babel: {
loaderOptions: {
ignore: ["./node_modules"],
},
},
}; As a temporary fix, ignoring all of the node modules resolved the issue :-/ |
I actually had to switch to google maps because I could not find a workaround that worked without removing this from transpile. |
Could you please explain a lil bit more ... am very new to coding but I want to display this mapbox style map using netlify.. I have doubt on how to set that ignore option |
I noticed that they change their doc link, so it's broken. I don't know why craco doesn't work for some people, maybe there is different setup? |
This was the only thing that worked for me. But I'm trying to understand why, it seems like everything points to the problem being in the mapbox dependency, why isn't ignoring that enough? |
Does my hello-world.zip work for you? |
Working for me now by editing module.exports = {
babel: {
loaderOptions: {
ignore: ['./node_modules/mapbox-gl/dist/mapbox-gl.js'],
},
},
}; My "dependencies": {
"mapbox-gl": "^2.5.1",
"react-map-gl": "^6.1.17",
},
// ...
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 3 safari version"
]
}, I put an answer up on SO with the same solution https://stackoverflow.com/questions/66421921/react-map-gl-cannot-find-variable-on-production-build/70060851#70060851 |
Editing |
Editing package.json worked for me. I'm using maplibre-gl
check this: https://docs.mapbox.com/mapbox-gl-js/guides/install/#targeting-transpilation-to-es6-with-browserslist |
I can confirm this. My previous setting was not working: |
did not work for me, I am really surprised no official fix for this. |
Worked for me |
We're using // craco.config.js
module.exports = {
babel: {
loaderOptions: {
ignore: ["./node_modules/maplibre-gl/dist/maplibre-gl.js"],
},
}, |
This error occurs in production but works well in development
The text was updated successfully, but these errors were encountered: