-
-
Notifications
You must be signed in to change notification settings - Fork 153
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: source maps in Node v21.6.0+ & v20.12.0+ #518
Changes from 10 commits
999b9a9
49645e0
8495eff
33f6c64
b6ef830
4560ee9
2249ec6
b1f23c8
b2bd9e0
1d5966b
19ea651
b6198ca
218e9ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
20.10.0 | ||
v20.12.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,11 @@ export const importAttributes: Version[] = [ | |
export const testRunnerGlob: Version[] = [ | ||
[21, 0, 0], | ||
]; | ||
|
||
// https://nodejs.org/docs/latest-v20.x/api/cli.html#--enable-source-maps | ||
// https://github.com/nodejs/node/pull/50827 | ||
// Allow using --enable-source-maps together with custom Error.prepareStackTrace | ||
export const prepareStackTraceExposed: Version[] = [ | ||
[20, 12, 0], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also Seems nodejs/node#50827 is included in the following releases (ordered by release date): |
||
[21, 6, 0], | ||
]; |
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.
Upon reading what the default
prepareStackTrace
looks like, I'm okay with removing this check entirely.The Node docs previously implied that if it was overridden sourcemaps wouldn't work expectedly, but the implementation is actually so simple that the default behavior can easily be replicated from the user-end.
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.
are you sure remove checking Error.prepareStackTrace? I don't know the history.
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.
Hmm, I dug into it deeper...
Previously, the Node docs said:
And the
prepareStackTrace
logic was:Not generating source maps when
Error.prepareStackTrace
was set was a performance optimization because I assumed the customprepareStackTrace
wouldn't be able to handle the source map. But this may have been an incorrect assumption. Furthermore, it's a rare optimization because I thinkError.prepareStackTrace
is not very common.That said, it's probably fine to remove this check entirely for how little benefit it provides, and the possibility that a custom
prepareStackTrace
can handle source maps.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.
removed