-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Uncaught SyntaxError: Unexpected token export #2049
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
Comments
Error happens because latest CRA uses webpack 1. To use webpack 2: |
This seems like a problem with the module you use, really. Publishing untranspiled ES6 modules as an entry point is not recommended, as it doesn’t work in Node or with older bundlers. Additionally relying on canary releases of |
This lib provides both versions like this (source code): "main": "dist/index.js",
"module": "dist-es6/index.js",
"scripts": {
"build-es5": "mkdir -p dist && babel src --out-dir dist --plugins=transform-es2015-modules-commonjs --source-maps inline",
"build-es6": "mkdir -p dist-es6 && babel src --out-dir dist-es6 --source-maps inline", @gaearon is it considered to be a bad practice? PS I explicitly required ES6 module, without realisation that CRA stable still use webpack 1 instead of webpack 2 |
Ah, I see! Then the library is fine. 👍 |
Can you reproduce the problem with latest npm?
Description
Seeing following error in browser console:
Trying to export ES6 module from node_modules. Is it wrong webpack configuration or I miss something in ES6 syntax? File from which I'm trying to export looks like this:
Environment
Reproducible Demo
https://github.com/stereobooster/create-react-app-map-gl
The text was updated successfully, but these errors were encountered: