vue-cli-plugin-qiankun
vue-cli-plugin-qiankun copied to clipboard
application 'foo-app' died in status LOADING_SOURCE_CODE: Failed to fetch
$ cd examples $ yarn $ yarn install:all $ yarn serve:all
你好,我运行以上4句后,打开F12,控制台报错信息如下:
Failed to load resource: net::ERR_EMPTY_RESPONSE
Uncaught TypeError: application 'foo-app' died in status LOADING_SOURCE_CODE: Failed to fetch
单独运行两个子项目是ok的 请问有解决的方式吗?谢谢
子项目启动时端口号有变吗,主项目开发时是依赖端口号的
没变,直接把代码拉下来后运行那4句,就报错了。在win7和win10都试了,报错信息一致
yarn serve:all 后单独访问 8081 和 8082 都是好的吗
单独访问8081和8082是ok的,不能在主页面切换foo-app
我这儿 mac 没问题,晚上回去用 win 再试下看看,之前应该也都是好的
还是没复现,你看下主应用加载 foo-app 的请求成功了没,返回的结果是啥
端口号没变,安装后运行就报错
在 2020-08-05 18:20:41,"徒言" [email protected] 写道:
子项目启动时端口号有变吗,主项目开发时是依赖端口号的
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
看眼网络请求的结果
解决了吗?
通过fetch访问子项目,需要子项目进行可跨域配置,vue.config.js:
devServer: { headers: { 'Access-Control-Allow-Origin': '*' } }
配置了
headers: {
'Access-Control-Allow-Origin': '*'
}
还是不行
Failed to load http://localhost:8081/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Failed to load http://localhost:8081/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
配置完后重启子项目
使用 localhost
遇到同样的问题,请问解决了吗?
有后续么?同样的问题 愁死了
同
有解决吗
same here
通过fetch访问子项目,需要子项目进行可跨域配置,vue.config.js:
devServer: { headers: { 'Access-Control-Allow-Origin': '*' } }
感谢,修改子应用的webpack后重启项目,成功解决