-
Notifications
You must be signed in to change notification settings - Fork 573
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
子应用采用cdn加载库文件,报错,库文件全局未定义, #1362
Comments
Hello @shuixiaobin. In order to facilitate location and troubleshooting, we need you to provide a realistic GitHub repository. |
https://gitee.com/shuixiaobin/micro-app-demo.git
|
仓库地址已补充,主应用子应用都在一个里面,多谢;https://gitee.com/shuixiaobin/micro-app-demo.git |
@shuixiaobin 基座启动的时候,加一下 几个未定义变量的替换就行了 microApp.start({
plugins: {
modules: {
"my-app": [{
loader(code, url) {
// 按实际情况 加js文件判断
// VUE
code = code.replace('var Vue', 'window.Vue')
// VUE-ROUTER
code = code.replace('var VueRouter', 'window.VueRouter')
// ElementPlusIconsVue
code = code.replace('var ElementPlusIconsVue', 'window.ElementPlusIconsVue')
return code
}
}]
}
}
}) |
Is your feature request related to a problem? Please describe.
主应用: vue3+vite
子应用: vue3+vite
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
请问怎么解决呢,子应用要改成npm包的形式引用是可以的,如果不改子应用主应用要怎么改下可以适配这种场景?多谢
The text was updated successfully, but these errors were encountered: