Browse Source

add some reposity

night-cherry 3 weeks ago
parent
commit
99f07e1bf1
1 changed files with 16 additions and 1 deletions
  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'
+        }
+      }
+    }
+  }
 }