feat: support overlay display unhandled runtime errors#2310
feat: support overlay display unhandled runtime errors#2310nanianlisao wants to merge 4 commits intoweb-infra-dev:mainfrom
Conversation
✅ Deploy Preview for rsbuild ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| @@ -0,0 +1,86 @@ | |||
| // @ts-expect-error | |||
| import { SourceMapConsumer } from 'source-map'; | |||
There was a problem hiding this comment.
And we do not want to add third-party dependencies to @rsbuild/core, unless it can be prebundled to the compiled folder.
There was a problem hiding this comment.
Yes, I tried to upgrade source-map to 0.7.4 and ran into some problems. It seems to be a problem with the source-map package itself.
Do you think it would work if I prebundled source-map@0.5.7 into the compiled directory? If yes, I'll try to do it this way
There was a problem hiding this comment.
However, version 0.7.4 has a major problem that makes it unusable on the browser side. I don't think 0.5.7 should be rejected just because it's outdated, but whether it's more important to consider its usability.
I have found no good solution to this problem without changing the version. mozilla/source-map#459
There was a problem hiding this comment.
Maybe we can use source-map-js.
@9aoy Thanks for sharing.
I have a new problem. When I prebundler, I get an error: __filename is not defined.
I didn't find a good solution and had to improvise a less elegant solution.
The esm polyfill for __dirname is mostly Node-based. Sincerely hope to find a better solution.
There was a problem hiding this comment.
The prebundle is used to bundle Node.js packages, and source-map-js in imported in the client code, so it can not be prebundled.
There was a problem hiding this comment.
For the client code, I think the new code added in the PR should be imported on demand.
In other words, when the user does not enable the runtime error overlay, these code and source-map-js should not be bundled into the client code, otherwise it will introduce unused code and slow down the build.
There was a problem hiding this comment.
In other words, when the user does not enable the runtime error overlay, these code and
source-map-jsshould not be bundled into the client code, otherwise it will introduce unused code and slow down the build.
Okay, let's take a look
82b06ba to
ab644c0
Compare
ab644c0 to
5a2f9ac
Compare



Summary
support overlay display unhandled runtime errors。
The rendering is as follows:

Related Links
Checklist