question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CRA 2 breaks the use of mapbox-gl: Uncaught ReferenceError: _typeof is not defined

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Reproducable on a newly created app

Environment

System: OS: macOS High Sierra 10.13.6 CPU: x64 Intel® Core™ i7-7700HQ CPU @ 2.80GHz Binaries: Node: 10.9.0 - /usr/local/bin/node Yarn: 1.9.4 - /usr/local/bin/yarn Browsers: Chrome: 69.0.3497.100 Firefox: 61.0.2 Safari: 12.0 npmPackages: react: ^16.5.2 => 16.5.2 react-dom: ^16.5.2 => 16.5.2 react-scripts: 2.0.3 => 2.0.3 npmGlobalPackages: create-react-app: Not Found

First Try

https://gist.github.com/ChiefORZ/d2e77d2a3dd3703a54c8fd6fecf3f921

create-react-app temp-mapbox
cd temp-mapbox
yarn add react-map-gl
yarn start

create-react-app 2 should work with mapbox-gl. mapbox-gl breaks, because of Uncaught ReferenceError: _typeof is not defined. searching the webs for this error seems, that this error occurs when webpack uglifies the already uglified bundle and there the reference to _typeof gets removed. https://github.com/mapbox/mapbox-gl-js/issues/4359

i think this error occurs with cra 2 again, because it got updated to use webpack 4?!

Second Try

https://gist.github.com/ChiefORZ/8a06af95cbe1acd4e1fd4d37e970e5ca

then i thought i follow the recommended solutions by excluding mapbox-gl from webpack build. https://github.com/mapbox/mapbox-gl-js/issues/4348#issuecomment-339755919

but unfortunately this is not working as well, because it doesn’t use webpack_require and therefore Uncaught ReferenceError: require is not defined

Thanks for the help!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:23 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
Timercommented, Oct 4, 2018

It’s still worthwhile to note the way mapbox is generating their workers is very fragile and they will be prone to more breakages like this in the future. We should keep pressing for them to fix this on their end.

4reactions
Timercommented, Oct 3, 2018

This fix is out in 2.0.4! Please upgrade and test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-map-gl: uncaught ReferenceError: _typeof is not defined
The map frame with mapbox logo renders but nothing else. My code : import React, { Component } from 'react'; import ReactMapGL from...
Read more >
Mapbox: Uncaught ReferenceError: y is not defined in ...
When building and running production, I met this issue. After see the error message in the console. I found documentation about this issue ......
Read more >
Export default class app extends component error - Weebly
The data table is not a function $(document).ready(function() ... New ES6 Class Features (in module /App.js) (/App.js:2) A cookie associated with a ...
Read more >
'Uncaught ReferenceError: y is not defined': how to solve this ...
Earlier today I was building an app and I needed to integrate with Ipinfo and Mapbox-gl. Mapbox... Tagged with javascript, mapbox, netlify.
Read more >
Profile for Stack Overflow - Linknovate
If I just try to import the byte-base64 script directly with a script tag then I end up with an error of: Uncaught...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found