New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack5中用import动态导入vue文件报错,怎么解决 #3469
Comments
我估计出现这个问题的底层原因是 好好研读,你大概就能知道原因了。 |
好的,谢谢 |
Greetings I have the same problem, I had to solve in an impractical way with a switch case, evaluating all possible values of the variable. renderDashboard() {
const { fileName } = this.metadata
// TODO: Add support to this list of currently unsupported dashboards
if (this.unsupportedDashboards.includes(fileName)) {
return
}
let dashboard
switch (fileName) {
case 'recentItems':
dashboard = () => import('@/components/ADempiere/Dashboard/recentItems')
break
case 'userfavorites':
dashboard = () => import('@/components/ADempiere/Dashboard/userfavorites')
break
case 'docstatus':
dashboard = () => import('@/components/ADempiere/Dashboard/docstatus')
break
default:
dashboard = () => import('@/components/ADempiere/Dashboard/calendar')
break
}
return dashboard
// return () => import(`@/components/ADempiere/Dashboard/${fileName}`)
} |
Question(提问)
webpack5中用import动态导入vue文件报错,试了很多网上说的方法都不行,试过的方案可查看下面的内容。
试过的方案:
①component: item.component === '#' ? Layout : () => import(
@/views/${component }.vue
) //变量写法②require组件的方式
③安装插件babel-plugin-dynamic-import-webpack的方式
用了上面的三种方案都报错,不知道咋搞了,求大神们帮看看,谢谢
The text was updated successfully, but these errors were encountered: