我正在尝试在 VS Code (v. 1.24.0) 中调试 Node/Express TypeScript 应用程序,但在调试过程中我的所有断点都显示为灰色。
错误是“未验证断点,已设置断点但尚未绑定。”我已经搜索过,但无法弄清楚我的配置有什么问题。控制台中没有错误,当我选择进程时调试器成功附加,但断点不起作用。
我该如何调试这个?
基本文件夹结构:
/.vscode
/src/server.ts
/dist/server.js
launch.json
tsconfig.json
启动.json
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"protocol": "inspector",
"address": "localhost",
"port": 8080,
"restart": true,
"preLaunchTask": "npm: build",
"sourceMaps": true,
"outFiles" : [ "${workspaceFolder}/dist/**/*.js" ]
},
tsconfig.json
{
"compilerOptions": {
"alwaysStrict": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es6",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"typeRoots": [ "node_modules/@types" ]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
]
}
任务.json
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
}
} ]