Explorar el Código

vue.config.js设置

panyong hace 4 años
padre
commit
149b4e99ff
Se han modificado 1 ficheros con 29 adiciones y 0 borrados
  1. 29 0
      htmldev/loan/vue.config.js

+ 29 - 0
htmldev/loan/vue.config.js

@@ -79,6 +79,35 @@ module.exports = {
     const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
     types.forEach(type => addStyleResource(config.module.rule('scss').oneOf(type)))
 
+    config.optimization.splitChunks({
+      chunks: 'all',
+      cacheGroups: {
+        vendors: {
+          name: 'chunk-vendors',
+          test: /[\\/]node_modules[\\/]/,
+          chunks: 'all',
+          priority: 2,
+          reuseExistingChunk: true,
+          enforce: true
+        },
+        vantUi: {
+          name: 'chunk-vantUi',
+          test: /[\\/]node_modules[\\/]vant[\\/]/,
+          chunks: 'all',
+          priority: 3,
+          reuseExistingChunk: true,
+          enforce: true
+        },
+        commons: {
+          name: 'chunk-commons',
+          test: resolve('src/components'), // can customize your rules
+          minChunks: 3, //  minimum common number
+          priority: 5,
+          reuseExistingChunk: true
+        }
+      }
+    })
+
     config.plugin('define').tap(args => {
       args[0]['process.env'] = Object.assign({}, args[0]['process.env'], env)
       return args