vue-cli-plugin-qiankun icon indicating copy to clipboard operation
vue-cli-plugin-qiankun copied to clipboard

application 'foo-app' died in status LOADING_SOURCE_CODE: Failed to fetch

Open mokedeng opened this issue 4 years ago • 20 comments

$ 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的 请问有解决的方式吗?谢谢

mokedeng avatar Aug 05 '20 08:08 mokedeng

子项目启动时端口号有变吗,主项目开发时是依赖端口号的

F-loat avatar Aug 05 '20 10:08 F-loat

没变,直接把代码拉下来后运行那4句,就报错了。在win7和win10都试了,报错信息一致

mokedeng avatar Aug 06 '20 02:08 mokedeng

yarn serve:all 后单独访问 8081 和 8082 都是好的吗

F-loat avatar Aug 06 '20 02:08 F-loat

单独访问8081和8082是ok的,不能在主页面切换foo-app

mokedeng avatar Aug 06 '20 02:08 mokedeng

我这儿 mac 没问题,晚上回去用 win 再试下看看,之前应该也都是好的

F-loat avatar Aug 06 '20 03:08 F-loat

还是没复现,你看下主应用加载 foo-app 的请求成功了没,返回的结果是啥

F-loat avatar Aug 07 '20 09:08 F-loat

端口号没变,安装后运行就报错

在 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.

mokedeng avatar Aug 10 '20 15:08 mokedeng

看眼网络请求的结果

F-loat avatar Aug 11 '20 03:08 F-loat

解决了吗?

huangfushengkun avatar Sep 28 '20 01:09 huangfushengkun

通过fetch访问子项目,需要子项目进行可跨域配置,vue.config.js:

devServer: { headers: { 'Access-Control-Allow-Origin': '*' } }

lishan-ls avatar Sep 28 '20 09:09 lishan-ls

配置了 headers: { 'Access-Control-Allow-Origin': '*' } 还是不行 Uploading image.png…

CIGE-Vince avatar Oct 14 '20 03:10 CIGE-Vince

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.

CIGE-Vince avatar Oct 14 '20 03:10 CIGE-Vince

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.

配置完后重启子项目

lishan-ls avatar Oct 14 '20 03:10 lishan-ls

使用 localhost

jtbss avatar Dec 29 '20 10:12 jtbss

遇到同样的问题,请问解决了吗?

YY0908 avatar May 28 '22 09:05 YY0908

有后续么?同样的问题 愁死了

puchunjie avatar Jun 10 '22 08:06 puchunjie

imberZsk avatar Jun 21 '22 13:06 imberZsk

有解决吗

lifeblood123 avatar Jul 25 '22 06:07 lifeblood123

same here

zhaoying-zoe avatar Aug 22 '22 08:08 zhaoying-zoe

通过fetch访问子项目,需要子项目进行可跨域配置,vue.config.js:

devServer: { headers: { 'Access-Control-Allow-Origin': '*' } }

感谢,修改子应用的webpack后重启项目,成功解决

toSeeWorld avatar Oct 08 '22 08:10 toSeeWorld