Replicate Typescript VSCode Debug in: launch.json

3 hours ago 2
ARTICLE AD BOX

I am looking for a solution to a (apparently rare) setup of a .vscode/launch.json config file, specifically for debugging Typescript directly.

This is extremely easy and simple to do manually in VSCode:

Click: Run and Debug in the side-menu. npx tsx {file.ts} in the integrated terminal that pops up. Profit - you are now hitting the breakpoints you've set inside VSCode on Typescript directly (no browser necessary).

You would think automating this in a launch.json would also be just as easy, but it's turning into an entire project all by itself.

VSCode official docs Debugging Typescript only cover an overcomplicated transpilation method. And that seems to be the basic assumption of almost everyone getting into debugging Typescript.

I have tried to replicate this process myself. It looks like this:

"configurations": [{ "name": "Debug: test.ts", "type": "node-terminal", "request": "launch", "command": "npx tsx test.ts", "cwd": "${workspaceFolder}/node" }]

When hovering over type, the given hint even claims this is exactly the same Javascript Debug Terminal that I use manually: Hover hint on type

Yet it does not stop on the breakpoints!
It gives an impression that something has run for several seconds, and then nothing happens.

Here I am doing this manually and succeeding: manual debug working successfully

Anyone out there have enough knowledge/experience to dissect the problem or have handled something like this yourself?

Thank you for your time, in advance.

Read Entire Article