-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Module parse failed: Unexpected token #11266
Comments
I can't reproduce this with a simple |
@darwin2k I just hit this too, if you import This also means the documentation at https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling is old now? it suggests Chrome >52 but looks like 2.6 is bumped up the minimum versions? In my case I'm using a 3rd party SDK that controls the preset-env targets so I'm following up with them. |
Good catch @kriscarle It does look like we may need to update the docs. |
@kriscarle What browser did you notice this on? And can you or @darwin2k say more about your build setups that are causing this? What version did you upgrade to 2.6 from? Did simply updating the browerslist solve the issue or did you have to do something else? It's clear that the use of Object spread syntax in the projections work in 2.6 is the root cause but I've been unable to reproduce the issue and I'm unclear on why this would be an issue even without transpilation unless you were on an old browser that didn't support the syntax. If you can offer any insights, that might help us determine what is happening here. I'm also going to re-open this since it seems like it may ultimately require some action on our end. |
@ryanhamley However, I updated my whole webpack configuration. After this, the error we are talking about does not occure anymore. |
Thanks for the update! That's very helpful. |
@ryanhamley In my case I'm using the Airtable Blocks SDK Airtable/blocks#18 They should maybe switch to using browerslist instead of hardcoded versions. I think |
We published GL JS v2.6.1 which removes the Object spread syntax so your existing setups should work as expected. Thanks for helping us figure out the issue! |
mapbox-gl-js version: 2.6.0
browser: chrome Version 97.0.4692.8
Steps to Trigger Behavior
Actual Behavior
./node_modules/mapbox-gl/dist/mapbox-gl.js Module parse failed: Unexpected token (31:397957) You may need an appropriate loader to handle this file type.
when imported into my React-application
import mapboxgl from "mapbox-gl";
The text was updated successfully, but these errors were encountered: