Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #5267
Closed
Open
Issue created Oct 03, 2018 by Administrator@rootContributor

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

Created by: ChiefORZ

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(R) Core(TM) 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!

Assignee
Assign to
Time tracking