赞
踩
vue 项目可以正常启动运行,但是打包时却 js 报错,因为 uglifyjs-webpack-plugin 不支持新的 es6 语法,解决方法就是使用 terser-webpack-plugin 替换 uglifyjs-webpack-plugin
Error in from UglifyJs Unexpected
undefined
Build failed with errors.
解决方法,使用新的 terser-webpack-plugin 创建替换旧的 uglifyjs-webpack-plugin
npm install terser-webpack-plugin -D
const TerserJSPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimizer: [new TerserJSPlugin({
cache: true,
paraller: true
})],
}
};
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。