在vscode中調試nest

網上方法

若是用了tsconfig.paths功能就報錯node

{
  "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"
      }
  ]
}

debugger 已有進程(npm run start:debug)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to node",
            "type": "node",
            "request": "attach",
            "restart": true,
            "processId": "${command:PickProcess}"
        }
    ]
}
相關文章
相關標籤/搜索