Skip to content
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

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

Open
mokedeng opened this issue Aug 5, 2020 · 20 comments

Comments

@mokedeng
Copy link

mokedeng commented Aug 5, 2020

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

@F-loat
Copy link
Owner

F-loat commented Aug 5, 2020

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

@mokedeng
Copy link
Author

mokedeng commented Aug 6, 2020

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

@F-loat
Copy link
Owner

F-loat commented Aug 6, 2020

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

@mokedeng
Copy link
Author

mokedeng commented Aug 6, 2020

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

@F-loat
Copy link
Owner

F-loat commented Aug 6, 2020

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

@F-loat
Copy link
Owner

F-loat commented Aug 7, 2020

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

@mokedeng
Copy link
Author

mokedeng commented Aug 10, 2020 via email

@F-loat
Copy link
Owner

F-loat commented Aug 11, 2020

看眼网络请求的结果

@huangfushengkun
Copy link

解决了吗?

@lishan-ls
Copy link

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

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

@CIGE-Vince
Copy link

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

@CIGE-Vince
Copy link

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
Copy link

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.

配置完后重启子项目

@jtbss
Copy link

jtbss commented Dec 29, 2020

使用 localhost

@YY0908
Copy link

YY0908 commented May 28, 2022

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

@puchunjie
Copy link

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

@imberZsk
Copy link

@lifeblood123
Copy link

有解决吗

@zhaoying-zoe
Copy link

same here

@toSeeWorld
Copy link

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests