【问题标题】:Node.js TypeScript debugging in VS CodeVS Code 中的 Node.js TypeScript 调试
【发布时间】:2017-06-24 19:05:39
【问题描述】:

谁能提供一个 VS Code 配置示例,让我能够:

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

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

【问题讨论】:

标签: node.js debugging typescript visual-studio-code


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-11-01
    • 1970-01-01
    • 2021-10-05
    • 2018-12-25
    • 2020-01-01
    • 2020-08-25
    • 1970-01-01
    • 2021-12-19
    • 2016-12-29
    相关资源
    最近更新 更多