日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

webpack分離公共模塊失敗

作者:Krlin_ 更新時間: 2022-07-02 編程語言

原因

根據官方文檔提示:

webpack will automatically split chunks based on these conditions:
New chunk can be shared OR modules are from the node_modules folder
New chunk would be bigger than 30kb (before min+gz)
Maximum number of parallel requests when loading chunks on demand would be lower or equal to 5
Maximum number of parallel requests at initial page load would be lower or equal to 3

默認配置中公共模塊的大小要大于30kb滿足其他條件才會進行分離

解決辦法

在webpack配置文件中設置 minisize屬性,降低打包標準

//... 其他基礎配置
optimization: {
    splitChunks: {
      // 包含所有chunks
      chunks: "all",
      automaticNameDelimiter: "-",
      minSize: 30, // 默認提取出的新chunk在兩次壓縮(打包壓縮和服務器壓縮)之前要大于30kb
    },
  },

原文鏈接:https://blog.csdn.net/weixin_46353030/article/details/125398200

欄目分類
最近更新