100.VUE的优化

1.去掉后缀为map的文件

修改config/index.js,测试时打开true,生产时关闭false

productionSourceMap: false,

2.删除vendorXXX.js,通过CND引入

vendor文件由依赖库编译产生,如Vue、Element

  
    

3.路由懒加载

import Vue from 'vue'
import Router from 'vue-router'

const routes = [
  {
    path:'/',
    component:resolve => require(['@/vs/index/main'],resolve),
    children:[
      {
        path:'/home',
        component:resolve => require(['@/views/home/index'],resolve)
      }
    ]
  }
]

const router = new Router({
  routes
})
export default router;

你可能感兴趣的:(100.VUE的优化)