Browse Source

贷款-vue.config.js配置优化

panyong 4 years ago
parent
commit
e58db9b93e
2 changed files with 11 additions and 33 deletions
  1. 8 4
      htmldev/loan/src/router/index.js
  2. 3 29
      htmldev/loan/vue.config.js

+ 8 - 4
htmldev/loan/src/router/index.js

@@ -4,10 +4,14 @@ import VueRouter from 'vue-router'
 Vue.use(VueRouter)
 
 const routes = [
-  // {
-  //   path: '*',
-  //   redirect: '/404'
-  // },
+  {
+    path: '*',
+    redirect: '/404'
+  },
+  {
+    path: '/loan',
+    redirect: '/'
+  },
   {
     path: '/404',
     name: '404',

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

@@ -79,39 +79,13 @@ 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
     })
+
+    config.plugins.delete('preload')
+    config.plugins.delete('prefetch')
   },
   css: {
     extract: {