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.

4
  • Does it have to be node inspector ? Can you use VSCode or WebStorm ? Commented Feb 16, 2019 at 2:04
  • I'm looking for any solution that can be run on the command-line without dealing with a GUI. Commented Feb 16, 2019 at 2:10
  • What version of ts-node you are using ? Commented Feb 16, 2019 at 2:13
  • Using ts-node version 8.0.2 Commented Feb 16, 2019 at 5:37

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I've tried that too but if using the node-inspector debugger to attach to the process it still steps through compiled JavaScript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.