去掉console.log,以及开启gzip

const CompressionPlugin = require('compression-webpack-plugin');//引入gzip压缩插件
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === 'production') {
      //npm install terser-webpack-plugin -D, 去掉console
      config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
      return {
        plugins: [
          new CompressionPlugin({
            test: /\.js$|\.html$|\.css/,
            threshold: 10240,
            deleteOriginalAssets: false
          })
        ]
      }
    }
  },

 

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-30
  • 2021-12-29
  • 2021-06-07
  • 2021-08-16
  • 2021-12-03
相关资源
相似解决方案