3

Is there any means of having the node-inspector CLI (or any CLI-based debugger) display the original typescript file when debugging?

For example, for debugging typescript, I usually run something like: nodemon -e ts -w src -x "tsc -p . && node inspect ./dist/file.js". This works, but it debugs the transpiled javascript.

To work around this, I tried using ts-node like so: nodemon -e ts -w src -x "node inspect -r ts-node/register src/file.ts". Still, the debugger will show the transpiled JS.

sourcemap: true in tsconfig does not help, either.

Leeren
  • 1,931
  • 2
  • 20
  • 31

1 Answers1

2

Using the latest ts-node you should be able to do something like below:-

nodemon -e ts -w src -x "node --inspect -r ts-node/register src/file.ts"

Or use --inspect-brk

bhantol
  • 9,368
  • 7
  • 44
  • 81
  • I've tried that too but if using the node-inspector debugger to attach to the process it still steps through compiled JavaScript. – Leeren Feb 16 '19 at 02:44