vscode 调试 typescript

canoziia
2022-02-15 / 0 评论 / 340 阅读 / 正在检测是否收录...

看起来是最简单的配置方法了

来源: https://pkief.medium.com/how-to-debug-typescript-with-vs-code-9cec93b4ae56

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "preLaunchTask": "npm: build",
            "sourceMaps": true,
            "smartStep": true,
            "program": "${workspaceFolder}/app/main.ts",
            "console": "integratedTerminal",
            "outFiles": [
                "${workspaceFolder}/**/*.js"
            ]
        }
    ]
}

package.json:

{
  "name": "vscode-typescript-debugging",
  "version": "1.0.0",
  "devDependencies": {
    "typescript": "^2.7.2"
  },
  "scripts": {
    "start": "node out/app.js",
    "prestart": "npm run build",
    "build": "tsc"
  }
}
1

评论 (0)

取消