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

Wrong line numbers in stack traces when using Node v20 #291

Closed
2 tasks
thesmart opened this issue Aug 26, 2023 · 8 comments · Fixed by esbuild-kit/esm-loader#71
Closed
2 tasks

Wrong line numbers in stack traces when using Node v20 #291

thesmart opened this issue Aug 26, 2023 · 8 comments · Fixed by esbuild-kit/esm-loader#71
Labels
bug Something isn't working outdated

Comments

@thesmart
Copy link

thesmart commented Aug 26, 2023

Problem

I was writing a unit test, and noticed that stack traces have the wrong line numbers when using Node v20:

Switch to Node v20, run the test:

$ nvm use 20
$ node --loader tsx --no-warnings --test index.test.ts
  Error: is the line number right?
      at SomeLib.doSomething (file:///Users/smart/thesmart/repro-tsx-line-no/lib.ts:1:149)
      at TestContext.<anonymous> (file:///Users/smart/thesmart/repro-tsx-line-no/index.test.ts:1:121)

Switch to node v18, run the test:

$ nvm use 18
$ node --loader tsx --no-warnings --test index.test.ts
 Error: is the line number right?
     at SomeLib.doSomething (/Users/smart/thesmart/repro-tsx-line-no/lib.ts:3:11)
     at TestContext.<anonymous> (/Users/smart/thesmart/repro-tsx-line-no/index.test.ts:7:5)

The line numbers in v20 are wrong.

Expected behavior

I would expected Node v20 to work the same as Node v18 and to have the correct line numbers to match where the exception was thrown.

Minimal reproduction URL

https://github.com/thesmart/repro-tsx-line-no

Version

v3.12.7

Node.js version

v20.5.1

Package manager

yarn

Operating system

macOS

Contributions

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@thesmart thesmart added bug Something isn't working pending triage labels Aug 26, 2023
@privatenumber privatenumber mentioned this issue Sep 2, 2023
21 tasks
@privatenumber
Copy link
Owner

Filed an issue in Node.js: nodejs/node#49455

@privatenumber
Copy link
Owner

Should be fixed now. Get the update with npm update @esbuild-kit/esm-loader

@mbrevda
Copy link

mbrevda commented Sep 12, 2023

wow, this was just a tiny bug but it makes such a big difference to the dev experience. Thanks for fixing!

@neelance
Copy link

It seems like this regressed with v3.14.0. Using Node.js 20 the line numbers look right with v3.13.0 but not with v3.14.0 any more.

@neelance
Copy link

@privatenumber Could you please reopen this issue or should I open a new one?

@privatenumber
Copy link
Owner

Unless the repro above is broken with the latest tsx, can you open a new issue with reproduction?

@neelance
Copy link

You are right, the repro above seems to be fine with v4.2.0 on Node.js 20. Very similar issue that I'm seeing with our code, though. I'll figure out a new repro and open a new issue.

@neelance
Copy link

I've filed #404.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working outdated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants