-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
UglifyJs Syntax Error fails npm run build
but not npm start
#984
Comments
ES6 syntax in dependencies is currently not supported because we use Uglify. This will be fixed when we switch to Babili when it's more stable. Nevertheless it's important to stress that we aren't and won't be transpiling any dependencies. This is intentional. If your dependencies are published in ES6, your app will not work in browsers that don't support ES6. We don't transpile dependencies because:
This doesn't have to do with webpack per se, you can set up both browserify and webpack to transpile dependencies. But we don't recommend this and won't be doing this. Closing as non-actionable as long as we use Uglify. |
Oops, I was mistaken. You're right, browserify won't transform dependencies. Good to hear we're planning on moving to Babili! |
I have a similar issue but not with a dependency but with node itself. static/js/main.b4f163eb.js from UglifyJs
Unexpected character '`' [/usr/lib/nodejs/events.js:260,0] The line 260 in nodejs/events.js contains a template string: `${existing.length} ${type} listeners added. ` + For more information see cerebral/cerebral#389. |
We are getting the same error (unexpected character backquote in /usr/lib/nodejs/events.js) using react-scripts 0.7.0. How do we determine why webpack includes /usr/lib/nodejs/events.js in the build? We're using mainly react, redux, and a few bootstrap-related packages. Nothing fancy. Is there a "debugging mode" in webpack that would tell us why it's trying to including /usr/lib/nodejs/events.js in the build? |
ps: we tracked it down to react-bootstrap-table@2.5.7 The error disappears if we omit the import for this package. In general, how do we handle this? Is including certain packages incompatible with create-react-app? |
I figured it out. react-bootstrap-tables uses a package called 'Filter', which imports node.js's EventEmitter, which comes from events.js... I can reproduce the failure by simply adding:
to CRA's src/index.js. Isn't this a big problem? Presumably, there are numerous packages/npm that include node.js code that they expect to run in the browser... and with create-react-app, I can't use any of them? |
Here the problem is also EventEmitter. |
Please file a new issue about |
Done - see #1023 |
@gaearon I've got stuck in the related problem, please help me pre compiled version : a more ES5 compliant build · Issue #4 · moducks/moducks Why |
I also think that |
It would be neat if create-react-app would support ES6 deps. there are a lot of dependencies I'm relying on (especially around cryptocurrencies/ethereum libs, that are primarly written for Node, and Node does support ES6 now!) that currently publish ES6 code (basically just code with
|
is there no solution to this?????? |
Can you reproduce the problem with latest npm?
Yes.
Description
One of my npm modules causes the production (
npm run build
) builds to fail with an UglifyJs syntax error. However, I am able to run the app withnpm start
without any errors or problems.Expected behavior
Should be able to build production build if development build is working.
Actual behavior
When running
npm run build
:Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected): react-scripts@0.7.0node -v
: v6.9.0npm -v
: v3.10.9Then, specify:
Reproducible Demo
npm install evolutionary
import 'evolutionary'
at the top ofindex.js
npm start
. Confirm that app loads in browser w/ no errors.npm run build
. Error appearsI've never used webpack, but from my experience with browserify I would assume that ES6 syntax in dependencies would be handled just as fine as my app code.
The text was updated successfully, but these errors were encountered: