I have my app made with Reactjs.
I'm gettint this error when I try to run npm run-script build
:
ERROR in bundle.js from UglifyJs
SyntaxError: Unexpected token: name (x) [./react/stores/UserStore.js:52,20]
ERROR in bundle.js from UglifyJs
SyntaxError: Unexpected token: name (x) [./react/stores/UserStore.js:52,20]
The error is thrown twice. And the line of the file that is poiting is commented! And now I try without those lines and I'm still getting the same error. But this is the first time that I have this error, don't know why, and i haven't touched that file in weeks...
Any idea?
Well, in my case was that I didn't have
babel-preset-es2015
so:npm install --save-dev babel-preset-es2015
['es2015', 'es2016', 'react']
The Uglify will work with es6 code (es6 -[babel preset es2015]-> es5 -> webpack with uglify plugin -> done)