feat: optimize hmr with runtime error #1244
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ref: #1241
在没确定最优解之前,先做两件事缓解这个问题。
1、不捕获 unhandledrejection 错误
2、捕获到错误时提醒用户,Mako 会做刷新而非热更
Summary by CodeRabbit
runtime_hmr_entry.js
中修改了startReportingRuntimeErrors
函数,增加了对unhandledrejection
事件的错误处理,并为运行时错误提供了更详细的控制台日志记录。/src/index.tsx
中添加了一个带有错误消息的 promise 拒绝。/src/App.tsx
中修改了App
函数组件,使其返回<div>App Modified</div>
而不是<div>App</div>
。