vue加载 优化 懒加载 Loading chunk xxx failed

1.app.js加载时间过长,那就用懒加载优化,分割一下,用到的时候在加载

一般在index.js都是这样的 import home1 from '@/components/home1'  

 {path:'/home1 ',name:'home1 ',component:home1 },

 

改成这样{path:'/home1 ',name:'home1 ',component:resolve=>require(['@/components/home1 '],resolve)},  然后把上面import去掉就可以了,这样打包的时候就会分割多个js,加载会快一点

2.会出现 Loading chunk xxx failed的问题

这个需要在打包的vue加载 优化 懒加载 Loading chunk xxx failed这个文件里找到build

vue加载 优化 懒加载 Loading chunk xxx failed

把 /  改成  ./就可以了 加个.改变一下路径