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

react-map-gl with Mapbox v2 fails #1284

Closed
zanemountcastle opened this issue Jan 3, 2021 · 4 comments
Closed

react-map-gl with Mapbox v2 fails #1284

zanemountcastle opened this issue Jan 3, 2021 · 4 comments

Comments

@zanemountcastle
Copy link

After running a Webpack build (with create-react-app), I get the following error in the browser:

Uncaught ReferenceError: y is not defined

This is a known issue with mapbox-gl using the recent Mapbox v2 release, which can be resolved for the time being using:

mapboxgl.workerClass = require("worker-loader!mapbox-gl/dist/mapbox-gl-csp-worker").default;

However, when I migrated from mapbox-gl to react-map-gl, the error reappeared and the fixes suggested here don't seem to work.

react-map-gl works just fine when run locally without building.

@kylebarron
Copy link
Collaborator

duplicate of #1266

@sanchezzzs
Copy link

sanchezzzs commented Sep 14, 2022

Editing package.json worked for me. I'm using maplibre-gl

"browserslist": {
    "production": [
      "defaults",
      "not ie 11"
    ],
  },

check this: https://docs.mapbox.com/mapbox-gl-js/guides/install/#targeting-transpilation-to-es6-with-browserslist

@franciscocaballero
Copy link

Editing package.json worked for me. I'm using maplibre-gl

"browserslist": {
    "production": [
      "defaults",
      "not ie 11"
    ],
  },

check this: https://docs.mapbox.com/mapbox-gl-js/guides/install/#targeting-transpilation-to-es6-with-browserslist

Thank you! This also worked for me.

@TimMcCauley
Copy link

Editing package.json worked for me. I'm using maplibre-gl

"browserslist": {
    "production": [
      "defaults",
      "not ie 11"
    ],
  },

check this: https://docs.mapbox.com/mapbox-gl-js/guides/install/#targeting-transpilation-to-es6-with-browserslist

Indeed, also works for me using

"mapbox-gl": "^2.14.1",
"maplibre-gl": "^2.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-map-gl": "^7.0.23",

kuanb added a commit to kuanb/pm-maps-oak that referenced this issue Jun 10, 2023
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

5 participants