qiankun
qiankun copied to clipboard
vue-router.esm.js?8c4f:2079 ChunkLoadError: Loading chunk 66 failed.
复现步骤,错误日志以及相关配置
主应用域名localhost:3000 子应用域名localhost:3001 主子应用均采用vue-admin-template构建项目,会同时加载路由与菜单,路由是动态路由从服务器获取。
主应用有两个按钮: 父按钮、子按钮 。点击子按钮跳到子应用后,再点击主应用上面的父按钮跳回父应用(用的是this.$router.push())报如下错误
但是使用location.href可以跳转成功
报错信息:
vue-router.esm.js?8c4f:2079 ChunkLoadError: Loading chunk 66 failed.
(missing: http://localhost:3001/js/66.js)
at Function.requireEnsure [as e] (app.js:952)
at fn.e (app.js:187)
at Array.map (
相关环境信息
- qiankun 版本
- 2.4.3
- 浏览器版本:
- chrome 96.0.4664.110(正式版本) (x86_64)
- 操作系统:
- mac
我也是用的vue-admin-template模版,出现了这个问题
参考 https://github.com/umijs/qiankun/issues/1777#issuecomment-950114650
我也是用的vue-admin-template模版,出现了这个问题
你解决了吗
我项目中出现这个bug是因为我在基座中注册了子应用的路由。目前我就是用location.href进行跳转,后续会把基座中子应用的路由拆解出来。
我也是用的vue-admin-template模版,出现了这个问题
你解决了吗
我也是用的vue-admin-template模版,出现了这个问题
你解决了吗
最新发现,子应用需要在unmount的时候手动把router = null, @gongshun 给出的链接里面有demo
#1777 (comment) 有 router=null, 还是会报这个错。 报这个错的原因是:切换了子应用,从A->B, A中的资源模块停止加载了,但(可能是)实例仍然会处理这个资源,判断资源拿不到,然后抛出了错误。
最终路由改造成这样问题解决
上面是我子应用组装路由的核心代码
下面是主应用的
