Kaynağa Gözat

add some reposity

night-cherry 3 hafta önce
ebeveyn
işleme
99f07e1bf1
1 değiştirilmiş dosya ile 16 ekleme ve 1 silme
  1. 16 1
      webpack.config.js

+ 16 - 1
webpack.config.js

@@ -82,5 +82,20 @@ module.exports={
       filename:"index.html",
       chunks:['index'],
     }),
-  ]
+  ],
+  // 优化配置(如代码拆分)
+  optimization: {
+    splitChunks: {
+      chunks: 'all',
+      minSize: 20000,
+      cacheGroups: {
+        vendors: {
+          test: /[\\/]node_modules[\\/]/,
+          priority: -10,
+          reuseExistingChunk: true,
+          name: 'vendors'
+        }
+      }
+    }
+  }
 }