看起来是最简单的配置方法了
来源: 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"
}
}