ERROR in build.js from UglifyJs Unexpected token: punc (()
原因:使用了ES6的语法需要安装uglifyjs-webpack-plugin
1.安装
npm i -D uglifyjs-webpack-plugin
2.修改webpack.conf.js
//添加
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
//替换将
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
//替换为
new UglifyJsPlugin({
"uglifyOptions":
{
compress: {
warnings: false
},
sourceMap: true
}
}
),