UglifyJs
does not support ES6. The error most likely shortens the method syntax. For instance:
const obj = { method() {
When he sees an opening bracket, he expected instead of a colon:
const obj = { method: function() {
Is there a way to diagnose this?
It tells you the exact line in your piece, so take a look at it. In the error message that appears:
[1.350b2d8a46d91e3c0911.chunk.js:20075,15] ^ ^ ^ filename line column
Then you can just search your project for the identifier that you see. If you do not want to search the entire project, you can run webpack with the --display-chunks
flag. This will show which modules are included in the relevant pieces, so you only need to study them.
Instead of replacing the entire shorthand syntax, you can say that babel translates the shorthand syntax with the babel transform-es2015-shorthand-properties plugin.
To write: unit tests will not find such errors.
source share