nodemon: Using "ts-node" instead of "node" by default for ts files breaks the "--inspect" flag
nodemon -v: 1.19.0node -v: 12.0- Operating system/terminal environment: Alpine
- Using Docker? What image: node:12-alpine
- Command you ran:
nodemon --inspect=0.0.0.0:9229 -r tsconfig-paths/register -r ts-node/register/type-check ./src/main.ts
Expected behaviour
The --inspect flag correctly passed to the node executable.
Actual behaviour
The --inspect flag passed to the ts-node executable but ts-node doesn’t support that flag.
Created from PR https://github.com/remy/nodemon/pull/1552#issuecomment-489697831
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 15 (4 by maintainers)
Links to this issue
Commits related to this issue
- chore: work around nodemon ts-node issue; fix typo in test; improve resize code https://github.com/remy/nodemon/issues/1565 — committed to taye/interact.js by taye 5 years ago
Adding my use case, this is my command:
Which outputs:
I did have some luck with the following:
Which attaches the debugger as expected. Seems like more of an issue with ts-node than with nodemon itself. I’m also having issues with breakpoints matching up with the lines, but that’s definitely not a nodemon issue.
Another option is using
execMapin package.json:Now
nodemon --inspect-brk=9229 src/example.tsrunsnode --require ts-node/register/transpile-only --inspect-brk=9229 src/example.ts.Hi @remy. Thanks for your work on nodemon!
I’d prefer to have the option to specify exactly which modules node will require.
I think it would be reasonable to automatically add
--require ts-node/registerfor .ts files only if no--requireargs are provided to nodemon. This would make nodemon easier to use with typescript files, but without getting in the way of more customised setups.