-
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
_typeof is not defined #3422
Comments
Looks like a bug in babel (babel/babel#4125, not sure why this is closed). The dist mapbox-gl.js file does not use ES2015, please exclude it from transpilation. |
I've excluded it, thanks for the help. Edit (to help people in the future): |
FWIW, I've got bitten by this whole exclusion, better exclude only mapbox-gl with |
Hitting the same error here, it was hard to find because one minified becomes Waiting for the babel issue, in the meantime |
anyone has an idea how to solve it without excluding it from babeling? babel/babel#4125 is closed and locked without a resolution CRA solved it somehow by excluding so im more then confused...excluding is the worst option, cant it be solved in mapboxgl? |
New `nodeModules` loader significantly change behavior. It's specified in **Breaking changes** section but description is quite small. As example, @javan have issue with `nodeModules` loader (rails#1892). Also, in my build it breaks `mapbox-gl` package (mapbox/mapbox-gl-js#3422). This PR adds more details to `CHANGELOG.md` about `nodeModules` loader and receipt to keep previous behavior.
This is still an issue using
Getting
From webworker |
It sometimes happens when you are trying to read some javascript before load the js file. |
Seeing this aswell on Chrome 76 mapbox-gl@1.2.0 |
Worked around this by adding |
For rails devs scratching their heads at this, I found this fixed the problem:
|
…er loaders Manually set height of map div to get something visible for now More context: visgl/react-map-gl#874 lewagon/rails-templates#81 mapbox/mapbox-gl-js#3422
Was anybody able to do it using Parcel, and Babel 7? @cyrilchapon, did you find a way? It would be awesome to find a solution to this. |
@jordymeow nah I just gave up on parcel. |
I created my project with create-react-app, so I've got no direct access to the webpack.config file. I did the following:
however depending on the structure use in your webpack.config files in node_modules/react-scripts/config the helper function "babelExclude" might not be able to reference your babel loader definition and you will get an error like “cannot set property exclude of undefined” if that happens you will have to do what I did to make it work, which is checking your webpack.config files and figuring out where in the structure you will be able to write/override the exclude sentence (see my config-overrides.js below).
My version of "react-scripts": "2.0.0" (this is the one package that defines the webpack.config file for you) Not pretty but that did the trick for me without having to eject. You may want to remove de ^ sign in front of the version of react-scripts in your package.json. If the webpack,config changes you project might break again, or at least be aware that you will have to update config-overrides.js accordingly. Hope it helps someone! |
We're using parcel & babel 7, and fixed this by narrowing the scope of browsers we include in the browserslist property of our package.json. Some of the browsers we were including were causing the transform-typeof-symbol plugin to be applied, which is what causes this (something about this plugin doesn't work properly when typeof is used inside the web worker used by mapbox). |
Hey @zzzev , do you mind posting your package.json file? I'd love to see if this solves my issue too. |
The browserslist part:
We're using parcel 1.12.4, with no explicit babel dep and no babelrc file. |
This solution worked for me thanks @zzzev |
You are a wonderful human being |
Yeah, me too but, might this be a problem in the future? |
It works for me too. webpack version |
This worked for me |
I ran into this same issue with another module I'm using. This fixed it! |
Getting a
_typeof is not defined
error when usingbabel-preset-es2015
in Webpack. Not using the preset removes the error.v0.26.0:
Steps to Trigger Behavior
npm start
to start webpack-dev-server.Expected Behavior
Basic map is displayed over beige background.
Actual Behavior
Beige background is displayed.
The text was updated successfully, but these errors were encountered: