鍍金池/ 問答/網(wǎng)絡(luò)安全  HTML/ webpack+babel使用transform-object-rest-spr

webpack+babel使用transform-object-rest-spread插件之后main.js文件體積翻好幾倍

因為iviewui中的DatePicker需要用到擴展運算,可是添加transform-object-rest-spread插件之后產(chǎn)生的main.js文件體積翻好幾倍
.babelrc如下

{
  "presets": ["env"],
  "plugins": [
    [
      "transform-object-rest-spread", //支持iviewui中的擴展運算符
      "import",
      {
        "libraryName": "iview",
        "libraryDirectory": "src/components"
      }

    ]
  ]
}

warn信息如下

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (817 KiB)
      main.77c9e24ff58d4333e1a0.js

有沒有辦法降低文件體積?

回答
編輯回答
她愚我

我把它弄到480kb了
直接卸載transform-object-rest-spread
安裝stage-3:npm install --save-dev babel-preset-stage-3
.babelrc中設(shè)置"presets": ["env","stage-3"],
ie10下測試通過

2017年12月19日 20:45