动态路由按需加载-Cannot find module
修改路由懒加载方式
在/store/modules/permission.js文件里修改如下
export const loadView = (view) => {
if (process.env.NODE_ENV === 'development') {
return (resolve) => require([`@/views/${view}`], resolve)
} else {
// 使用 import 实现生产环境的路由懒加载 {{关键修改这里}}
// return () => import(`@/views/${view}`)
return (resolve) => require([`@/views/${view}`], resolve)
}
}