Add ts-node to your TypeScript project:
npm i ts-node
Add a script to your package.json
:
"start:debug": "ts-node --inspect=5858 --debug-brk --ignore false index.ts"
The launch.json
needs to be configured to use the node2 type and start npm running the start:debug
script:
{
"version": "0.2.0",
"configurations": [
{
"type": "node2",
"request": "launch",
"name": "Launch Program",
"runtimeExecutable": "npm",
"windows": {
"runtimeExecutable": "npm.cmd"
},
"runtimeArgs": [
"run-script",
"start:debug"
],
"cwd": "${workspaceRoot}/server",
"outFiles": [],
"port": 5858,
"sourceMaps": true
}
]
}