# taro3.0包体积过大问题

taroCollect

npm i --save-dev terser-webpack-plugin
1
/config/index.js

import TerserPlugin from "terser-webpack-plugin"

const config = {
    mini: {
      webpackChain(chain, webpack) {
        chain.mode("production");
        chain.optimization.minimize(true);
        chain.plugin("terser").use(TerserPlugin, [
          {
            cache: true,
            extractComments: false,
            terserOptions: {
              output: {
                comments: false
              }
            }
          }
        ]);
      }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

链接

Last Updated: 2/28/2023, 6:01:28 PM