VS.代码中的Node.js TypeScriptdebugging
有人可以提供一个VS Codeconfiguration的例子,可以让我:
- 启动Node.jsdebugging器
- 编辑任何TS文件,看到重新编译的项目和debugging器重新启动?
这是支持开箱吗? 可以使用nodemon
吗? 谢谢。
是的,你可以使用nodemon。 在你的launch.json中,如果你触发了智能感知(ctrl + space),你将会看到带有推荐configuration的片段。 有一个nodemon,看起来像这样:
{ "type": "node", "request": "launch", "name": "nodemon", "runtimeExecutable": "nodemon", "runtimeArgs": [ "--debug=5858" ], "program": "${workspaceRoot}/app.js", "restart": true, "port": 5858, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" }
该文档解释了它是如何工作的: https : //code.visualstudio.com/docs/editor/node-debugging#_restaring-debug-sessions-automatically-when-source-is-edited