const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true, // Must be set to true if using source-maps in production
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
}
}),
],
}
};
minimize
为false
禁用掉 就不会压缩了或者 重写压缩
minimizer
,(minimize
为true
的情况才能使用minimizer
)至于怎么设置
configureWebpack
或者chainWebpack
都行