【webpack配置】optimization

2022/03/08 22:50:04

作用

配置 webpack 的优化策略。

可配置项

minimizer

覆盖默认压缩工具

const TerserPlugin = require("terser-webpack-plugin");

module.exports = {
  optimization: {
    minimizer: [
      new TerserPlugin({
        parallel: true,
        terserOptions: {
          // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
        },
      }),
    ],
  },
};