Typescript 调试nestjs微服务框架

Typescript 调试nestjs微服务框架,typescript,visual-studio-code,microservices,nestjs,Typescript,Visual Studio Code,Microservices,Nestjs,我们如何在vscode中调试nest微服务框架 该框架是一个带有springboot约定的typescript项目 按F5,选择节点,将launch.json文件替换为: { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://

我们如何在vscode中调试nest微服务框架

该框架是一个带有springboot约定的typescript项目


按F5,选择节点,将launch.json文件替换为:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Debug Nest Framework",
            "args": ["${workspaceFolder}/src/main.ts"],
            "runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
            "sourceMaps": true,
            "cwd": "${workspaceRoot}",
            "protocol": "inspector"
        }
    ]
}

因此,放一个breakpoint并再次点击F5

如果您使用的是nestjs 6.8+(请参阅)

使用此内容在
.vscode
文件夹中添加
launch.json

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach NestJS WS",
      "port": 9229,
      "restart": true,
      "stopOnEntry": false,
      "protocol": "inspector"
    }
  ]
}
然后运行
npn运行开始:调试

然后在vscode中选择
attachnestjsws

完成了!您可以设置断点

调试“跳过”时无法正常工作(打开system.js文件)