问题一:
描述:
ValidationError: Invalid options object. Less Loader has been initialized using an options object
原因:
解决:
yarna add less-loader@5.0.0 -D
问题二
描述:
解决:
是因为我们是webpack4,所以在运用terser-webpack-plugin的时候一定要注意版本号,要用”terser-webpack-plugin”: “^4.2.3”,版本,否则会报一个 ‘javascript’ 的错误
const TerserPlugin = require('terser-webpack-plugin')
configureWebpack: {
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: {
drop_console: true,
drop_debugger: false,
pure_funcs: ['console.log'], // 移除console
},
},
}),
],
},
},