VSCode Node.js Typescript Debugging
Debugging ts-node
First create your launch.json
( visual studio code doc )
To allow breakpoints to work, we need to enable source maps in our launch.json
as shown below:
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["${file}", "--sample-arg", "test"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
Then get back to your file, and start the debugger.

Last updated
Was this helpful?