路由懒加载

// bad!
import Wrapper from '@/layout/components/Wrapper/index.vue'

// good!
const Wrapper = () => import('@/layout/components/Wrapper/index.vue')

优化前:
image.png

优化后:
image.png

webpack

1. productionSourceMap

// vue.config.js

module.exports = {
...
// source map 设置为false以加速生产环境构建
productionSourceMap: isProd ? false : true,
}

externals 和CDN