Skip to content
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

Source maps broken since versions 1.10.1 (up to and including latest 1.10.9) #848

Open
pasieronen opened this issue Aug 22, 2024 · 2 comments · May be fixed by #857
Open

Source maps broken since versions 1.10.1 (up to and including latest 1.10.9) #848

pasieronen opened this issue Aug 22, 2024 · 2 comments · May be fixed by #857

Comments

@pasieronen
Copy link

With version 1.10.0 this works as expected, and stack trace says test.ts:1:7 (which is correct):

npm i @swc-node/[email protected] 
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.

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.

@pasieronen pasieronen changed the title Source maps broken in version 1.10.1 Source maps broken since versions 1.10.1 (up to and including latest 1.10.9) Sep 11, 2024
@KidkArolis
Copy link

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.

@maxfliri
Copy link

The workaround does not work for me. Stack traces are always broken for me when source maps are inline. I opened a new issue to report this: #861.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants