Open pasieronen opened 1 month ago
With version 1.10.0 this works as expected, and stack trace says test.ts:1:7 (which is correct):
test.ts:1:7
npm i @swc-node/register@1.10.0 echo "throw new Error()" > test.ts node -r @swc-node/register test.ts
With version 1.10.1, the stack trace says test.ts:2:7.
test.ts:2:7
It looks like the change related to inlineSourceMap in #726 broke the non-inline case. Maybe this line changed in #726
sourcemap: options.sourceMap || options.inlineSourceMap ? 'inline' : Boolean(options.sourceMap),
should have been instead something like this?
sourcemap: options.inlineSourceMap ? 'inline' : Boolean(options.sourceMap)
...so we get non-inline source maps by default. At least with Node 20.17.0 the inline source maps don't seem to work without the fix suggested in #791.
Can confirm it's an issue - a workaround is to set inlineSourceMap: true in tsconfig.json instead of sourceMap: true if you're using TypeScript.
inlineSourceMap: true
sourceMap: true
With version 1.10.0 this works as expected, and stack trace says
test.ts:1:7
(which is correct):With version 1.10.1, the stack trace says
test.ts:2:7
.It looks like the change related to inlineSourceMap in #726 broke the non-inline case. Maybe this line changed in #726
should have been instead something like this?
...so we get non-inline source maps by default. At least with Node 20.17.0 the inline source maps don't seem to work without the fix suggested in #791.