关于webpack打包插件uglifyjs-webpack-plugin报错

错误内容大概为ERROR in app.bundle.js from UglifyJs Unexpected token: name «*», expected: punc «;»
类似这种报错,是因为最新版的uglifyjs-webpack-plugin插件已经不支持es6语法(https://github.com/webpack-contrib/uglifyjs-webpack-plugin/blob/master/CHANGELOG.md#200-2018-09-14)

解决方法
用插件terser-webpack-plugin代替uglifyjs-webpack-plugin

配上terser-webpack-plugin:用法

参考链接:https://codereviewvideos.com/blog/how-i-fixed-uglifyjs-unexpected-token-name-dropin/

你可能感兴趣的:(webpack)