I'm trying to build my project that uses webpack. My UglifyJS options looks like this:
new UglifyJSPlugin({
sourceMap: false,
uglifyOptions: {
compress: {
warnings: false,
},
output: {
comments: false,
},
},
}),
What I get is an error:
Unexpected token: punc ()) [index-3d0ae630eaa0a0128a00.js:145853,20]
I have found some SO topic saying that this might be a problem with webpack uglify plugin, but I've already switched to an uglifyjs-webpack-plugin.
Any ideas?
I had the same error and was able to fix it by:
npm i -D uglifyjs-webpack-plugin@beta)"uglifyjs": true to the targets in babel-preset-envIf you're using the env preset, try updating the targets in your .babelrc:
{
"presets": [
[
"env",
{
"targets": {
"uglify": true
}
}
]
]
}
There is also an issue on the plugin repo that lists other possible solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With