gpt4 book ai didi

VS Code 中的 Node.js TypeScript 调试

转载 作者:搜寻专家 更新时间:2023-10-30 21:52:06 26 4
gpt4 key购买 nike

有人可以提供一个 VS 代码配置示例,让我可以:

  • 启动 Node.js 调试器
  • 编辑任何 TS 文件,查看重新编译的项目和重新启动的调试器?

开箱即用吗? nodemon 可以以某种方式使用吗?谢谢。

最佳答案

是的,你可以使用 nodemon。在您的 launch.json 中,如果您触发智能感知 (ctrl+space),您将看到带有建议启动配置的片段。有一个用于 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

关于VS Code 中的 Node.js TypeScript 调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42091516/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com