vue 动态加载 Error: Cannot find module ‘@/views/xxx‘ at webpackEmptyContext (index.js:39)
报错:原来写法:export const loadView = (view) => {return () => import(`@/views/${view}`)}修改为:export const loadView = (view) => {return (resolve) => require([`@/views/${view}`], resolve)}原因:webpac
·
报错:
原来写法:
export const loadView = (view) => {
return () => import(`@/views/${view}`)
}
修改为:
export const loadView = (view) => {
return (resolve) => require([`@/views/${view}`], resolve)
}
原因:webpack 版本问题,webpack4中动态import不支持变量方式
更多推荐
已为社区贡献1条内容
所有评论(0)