We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
--enable-source-maps
Microsoft Windows NT 10.0.19044.0 x64
No response
hi.mjs
Create a source file, hi_src.ts:
hi_src.ts
// @ts-ignore Cannot find module node:path import { sep } from 'node:path' throw new Error(sep)
npm i -g esbuild esbuild hi_src.ts --outfile=hi.mjs --sourcemap=inline --format=esm
(Same results when you pass --sourcemap=linked)
--sourcemap=linked
import { sep } from "node:path"; throw new Error(sep); //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiaGlfc3JjLnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyIvLyBAdHMtaWdub3JlIENhbm5vdCBmaW5kIG1vZHVsZSBub2RlOnBhdGhcbmltcG9ydCB7IHNlcCB9IGZyb20gJ25vZGU6cGF0aCdcbnRocm93IG5ldyBFcnJvcihzZXApXG4iXSwKICAibWFwcGluZ3MiOiAiQUFDQSxTQUFTLFdBQVc7QUFDcEIsTUFBTSxJQUFJLE1BQU0sR0FBRzsiLAogICJuYW1lcyI6IFtdCn0K
cat hi.mjs | node --enable-source-maps --input-type=module
always
I'd expect to see the error on line 3, since that's where the error is in the source file.
Source map visualization
I see the error on line 2:
C:\Users\Joseph\Code\test>cat hi.mjs | node --enable-source-maps --input-type=module file:///C:/Users/Joseph/Code/test/[eval1]:2 throw new Error(sep); ^ Error: \ at file:///C:/Users/Joseph/Code/test/[eval1]:2:7 Node.js v18.13.0
This file works as expected if you pass the filename to node (the normal way of using node):
C:\Users\Joseph\Code\test>node --enable-source-maps hi.mjs C:\Users\Joseph\Code\test\hi_src.ts:3 throw new Error(sep) ^ Error: \ at <anonymous> (C:\Users\Joseph\Code\test\hi_src.ts:3:7) at ModuleJob.run (node:internal/modules/esm/module_job:194:25) Node.js v18.13.0
Not specific to ESM modules. I'm getting the wrong lines in stack traces for Common JS too.
The text was updated successfully, but these errors were encountered:
Was still broken in 20.16.0, but fixed in 20.17.0! 🎉
I'm guessing either #53860 or #51977 fixed it, but I really don't know.
Sorry, something went wrong.
No branches or pull requests
Version
Platform
Microsoft Windows NT 10.0.19044.0 x64
Subsystem
No response
What steps will reproduce the bug?
Details for how I generated
hi.mjs
Create a source file,
hi_src.ts
:(Same results when you pass
--sourcemap=linked
)hi.mjs
:cat hi.mjs | node --enable-source-maps --input-type=module
How often does it reproduce? Is there a required condition?
always
What is the expected behavior?
I'd expect to see the error on line 3, since that's where the error is in the source file.
Source map visualization
What do you see instead?
I see the error on line 2:
Additional information
This file works as expected if you pass the filename to node (the normal way of using node):
Not specific to ESM modules. I'm getting the wrong lines in stack traces for Common JS too.
The text was updated successfully, but these errors were encountered: