webpack-contrib / uglifyjs-webpack-plugin

[deprecated] UglifyJS Plugin
MIT License
1.38k stars 179 forks source link

ERROR in ./assets/js/commons.js from UglifyJs Unexpected token: keyword (const) #367

Closed m-korkut closed 6 years ago

m-korkut commented 6 years ago

I use uglifyjs-webpack-plugin. I get this error :"ERROR in ./assets/js/commons.js from UglifyJs Unexpected token: keyword (const) [./assets/js/commons.js:13526,0] "

what's the solution to this ?

version info : nodejs: v8.12.0 npm 6.4.1, webpack: "^4.21.0", "uglifyjs-webpack-plugin": "^2.0.1", "babel-loader": "^8.0.4",
babel : 7

mhavci commented 6 years ago

+1 same problem

alexander-akait commented 6 years ago

You code contains ES6, uglifyjs-webpack-plugin use uglify-js to compress code and uglify-js doesn't support ES6, use https://github.com/webpack-contrib/terser-webpack-plugin

kk-fan commented 5 years ago

Execution of "yarn add uglifyjs-webpack-plugin" can be temporarily resolved. The specific reasons need to be further searched.