在vscode中调试nest

37次阅读

共计 663 个字符,预计需要花费 2 分钟才能阅读完成。

网上方法

如果用了 tsconfig.paths 功能就报错

{
  "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",
          "console": "integratedTerminal"
      }
  ]
}

根据 nodemon-debug.json 改良后

{
  "version": "0.2.0",
  "configurations": [
      {
          "type": "node",
          "request": "launch",
          "name": "Debug Nest Framework",
          "args": ["${workspaceFolder}/src/main.ts"],
          "runtimeArgs": ["--nolazy", "-r", "ts-node/register", "-r", "tsconfig-paths/register"],
          "sourceMaps": true,
          "cwd": "${workspaceRoot}",
          "protocol": "inspector",
          "console": "integratedTerminal"
      }
  ]
}

正文完
 0