UglifyJsPlugin摇树

时间:2019-02-07 14:13:44

标签: webpack uglifyjs tree-shaking

我正在尝试在我们的项目中配置树状摇动,但不知道如何启用它。据我了解,UglifyJsPlugin允许与webpack一起使用树状摇动,但是我是否需要其他配置?

UglifyJsPlugin conf:

new UglifyJsPlugin({
  "test": /\.js(\?.*)?$/i,
  "extractComments": false,
  "sourceMap": false,
  "cache": true,
  "parallel": true,
  "uglifyOptions": {
    "output": {
      "ascii_only": true,
      "comments": false,
      "webkit": true
    },
    "ecma": 5,
    "warnings": false,
    "ie8": false,
    "mangle": {
      "safari10": true
    },
    "compress": {
      "typeofs": false,
      "inline": 3,
      "pure_getters": true,
      "passes": 3
    }
  }
}),

0 个答案:

没有答案