Closed
Description
Version
v21.2.0
Platform
All
Subsystem
All
What steps will reproduce the bug?
Reproduction: https://github.com/privatenumber/bug-node-hooks-cjs-sourcemap
I added a Hook (load
) that just reads the CommonJS file and returns the file as is (the same example from the docs). When loading a file with an inline source map, the error stack does not show the correct line number. You can see this in the reproduction by running npm start
.
In contrast, it works when the same file is directly with --enable-source-maps
without registering a Hook. You can see this in the reproduction by running npm run works
.
How often does it reproduce? Is there a required condition?
Every time when CJS is loaded with the Hooks API.
What is the expected behavior? Why is that the expected behavior?
For the source map to work
What do you see instead?
Incorrect error stack line numbers
Additional information
CJS support in Hooks were added in #47999
No response
Metadata
Metadata
Assignees
Labels
No labels