tsx: VS Code breakpoint with tsx and Nodejs 20.12.0 does not work
Acknowledgements
- I searched existing issues to avoid duplicates
- I understand this is a place to report a confirmed bug (not seek debugging help)
- I understand this is a collaborative open source project, and relies on community contributions
- I have read and understood the Contribution guide
Minimal reproduction URL
https://github.com/List-KR/multithread-array/pull/1
Version
4.7.1
Node.js version
20.12.0
Package manager
npm
Operating system
Linux
Problem & expected behavior (under 200 words)
-
What happened: All VS Code breakpoints are ignored
-
What I expected: VS Code breakpoint works as using Node.js 20.11.1
-
Screenshot:
Screenshot
-
devcontainer.json
{ "name": "Typescript with Rust", "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "features": { "ghcr.io/devcontainers/features/node:latest": { "nodeGypDependencies": true, "version": "lts" }, "ghcr.io/devcontainers/features/rust:latest": { "version": "latest", "profile": "default" }, "ghcr.io/devcontainers-contrib/features/bash-command:latest": { "command": "echo hi!" }, "ghcr.io/devcontainers-contrib/features/npm-package:latest": { "package": "typescript", "version": "latest" }, "ghcr.io/devcontainers-contrib/features/typescript:latest": { "version": "latest" }, "devwasm.azurecr.io/dev-wasm/dev-wasm-feature/rust-wasi:latest": {} }, "remoteUser": "root", "mounts": [ "source=${localEnv:HOME}/repos/Filters,target=/workspaces/resources/Filters,type=bind,consistency=cached", "source=${localEnv:HOME}/repos/Userscript,target=/workspaces/resources/Userscript,type=bind,consistency=cached" ] }
Contributions
- I will open a pull request for this issue
- I will support the work financially (any amount helps)
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Reactions: 4
- Comments: 20 (9 by maintainers)
Released in v4.7.2!
Thanks for your contribution @cenfun 🙌!
@privatenumber I create a new PR here https://github.com/privatenumber/tsx/pull/518 Could you please review it?
It seems that the root cause is because inline sourcemap no longer works in nodejs 20.12.0. VSCode debug might not work if there is no inline sourcemap.
(typeof Error.prepareStackTrace !== "function") === falsein nodejs 20.12.0, (see change https://github.com/nodejs/node/pull/50827) but it istruein nodejs 20.11.0tsxused above to install inline sourcemap, see https://github.com/privatenumber/tsx/blob/develop/src/source-map.ts#L21Hope this helps you.
Thanks @tenpaMk2
Would you or @piquark6046 be willing to investigate this?
I’m not personally affected by this so I’m unlikely to work on it unless paid to.
@bqp-articulate there is PR here https://github.com/privatenumber/tsx/pull/517
I can confirm this behavior, and I’ll add that I can also reproduce with the
tsxsmoketests in 20.12. If @cenfun isn’t submitting a PR for this, I’d be happy to - I’ve invested time already wrapping my head around this bit of code and I have a workaround by pinning my environment to node 20.11Paid 15 USD.
@privatenumber VS Code breakpoint works with Node.js 18.20.0. However, it does NOT work with Node.js 20.12.0. (Tested with tsx-vscode-debug-not-working on Dev Container)
Please take a look. I think that it is a major bug of your tsx package.