-
Notifications
You must be signed in to change notification settings - Fork 144
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
feat: support overlay display unhandled runtime errors #2310
base: main
Are you sure you want to change the base?
feat: support overlay display unhandled runtime errors #2310
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 [email protected]
into the compiled directory? If yes, I'll try to do it this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, [email protected]
was released 7 years ago and we won't use a legacy version..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use source-map-js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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