nodemon
should be started on debugging in Visual Studio Code and watch TypeScript. On any TypeScript changes, it should re-compile them using ts-node
. I'm struggling with many issues here. The currently most important one is that nodemon
watches only the generated .js
files, but not the original .ts
ones - although I explicit let them watch typescript.
launch.json
{
"type": "node",
"request": "launch",
"name": "nodemon",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/index.ts",
"outFiles": [
"${workspaceRoot}/dist/*.js"
],
"restart": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"args": [
"--inspect-brk",
"-x 'echo hello123'"
],
"timeout": 30000
}
When I start debugging, "hello123" is printed. After saving index.ts
nothing happens. If the generated dist/index.js
script is saved by hand, it shows "hello123" too.
Of course, this is only to isolate the issue. In fact, I want to run a npm script to re-compile typescript like this:
"scripts": {
"ts-node": "ts-node --inspect-brk index.ts"
}
But the main problem is: Why does nodemon
only watches the generated js-files instead of their typescript ones? Seems like this is caused by outFiles
attribute. Without it's not working, it shows an error that corresponding js files cant' be found.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…