-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fix(bundler-webpack): process undefined problem with hmr #10315
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Size Change: 0 B Total Size: 9.91 MB ℹ️ View Unchanged
|
Codecov ReportBase: 29.49% // Head: 29.49% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #10315 +/- ##
=======================================
Coverage 29.49% 29.49%
=======================================
Files 444 444
Lines 12902 12902
Branches 3145 3145
=======================================
Hits 3806 3806
Misses 8504 8504
Partials 592 592 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
why?
from @fz6m
现状就是 react-error-overlay 没法用了,控制台报错 process undefined。
看了下,这个问题前年就有了,我也不用 react-error-overlay ,不太晓得这个问题:
facebook/create-react-app#11773
facebook/create-react-app#12212
CRA 官方摆烂了,最新版本也是去年 4 月的,都快 1 年没更新了,一些网上的解法:
https://stackoverflow.com/questions/70368760/react-uncaught-referenceerror-process-is-not-defined
目前社区里看起来靠谱的解法是回退到 6.0.9 ,问题的原因是 6.0.10 开始 CRA 把构建工具换成 webpack5 了,但是没配 webpack5 的 node polyfill (webpack 5 开始不包含 polyfill),导致 process 被原模原样输出来了。
还有一个可能的解法,参考:facebook/create-react-app#11799 ,自己 fork 改一下 webpack 配置自己构建一份 react-error-overlay ,但我觉得他这个 PR 有点小问题,process 用 process/browser.js 感觉会更好。