Source map adds null.<anonymous>
to stack trace
#4982
Unanswered
privatenumber
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When providing a file with a source map (via native source maps), the stack trace includes
null.<anonymous>
in the location of the error.Since there are actually no transformation happening (source map and source file are 1:1), I'm suspicious that this is a bug in Node.js.
My goal is to load the source map to show a stack trace identical to the one without a source map.
Error with source map
I use a loader to apply a transformation and create a source map. In this case, I don't actually make any changes, and I generate a 1:1 source map.
Strangely, it displays
null.<anonymous>
in the first row of the stack.(Note: the
:1:1
location is a little inaccurate but it's because I provide a low-resolution map. It maps accurately when I use a high-resolution map.)Expected error
When there is no loader/source maps provided, the error displays correctly:
Reproduction
mapped.mjs
with the following contents:(The source map is Base64 inlined—details below.)
Details
Code
index.mjs
Generated source map
The source map is a 1:1 mapping as demonstrated via source map visualization.
Beta Was this translation helpful? Give feedback.
All reactions