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

子应用React18+vite 搭建报错 #15

Open
510279293 opened this issue Aug 27, 2023 · 5 comments
Open

子应用React18+vite 搭建报错 #15

510279293 opened this issue Aug 27, 2023 · 5 comments

Comments

@510279293
Copy link

你好,我的应用构建是这样的:
主应用基座是 React18+vite (正常)
子应用Vu3+vite (正常)
子应用React18+vite (报错) ,报错显示:
app-errors.js:11 Uncaught Error: application 'react-app' died in status BOOTSTRAPPING: React refresh runtime was loaded twice. Maybe you forgot the base path? at @react-refresh:665:11
如果React子应用 中使用了 函数式 组件就会报上述错误

@510279293 510279293 changed the title 子应用React18+vite 搭建 子应用React18+vite 搭建报错 Aug 27, 2023
@lishaobos
Copy link
Owner

请问,是否设置了:fastRefresh: false

@510279293
Copy link
Author

你好,问题解决了,方法如下:
在react应用的 vite.config.ts 配置文件中 plugin 项中去掉 react 插件,问题得以解决;
但是没有找到问题的原因,不晓得是不是 @vitejs/plugin-react 与 vite-plugin-legacy-qiankun 插件的不兼容问题,我用的版本为:
"@vitejs/plugin-legacy": "^4.1.1",
"@vitejs/plugin-react": "^4.0.0",
"vite": "^4.3.9",
"vite-plugin-legacy-qiankun": "^0.0.12"

@lishaobos
Copy link
Owner

你可以参考我这个评论,#13 (comment)

暂时将 react 插件恢复到 3.x,然后设置 fastRefresh: false

@510279293
Copy link
Author

好的,非常感谢

@lishaobos
Copy link
Owner

请问有解决你的问题吗

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

2 participants