Inspiration was taken from Eduardo Rabelo - https://eduardorabelo.me - from this article: https://dev.to/oieduardorabelo/nodejs-with-typescript-debug-inside-vscode-and-nodemon-23o7
To start debugging, you need to first start the dev:debug
npm script with npm run dev:debug
,
then run the Node: Nodemon
launch configuration from VSCode, in order to attach the debugger to the app process.
Pick the nodemon process when prompted, the one that should look like
npx nodemon --inspect src/index.ts
. It's the process that stays alive and restarts the app process when you make changes (of course it first feeds the *.ts
code to ts-node
for transpilation because of that node --require ts-node/register
line in nodemon.json
).