我过去24小时都在观看/阅读有关如何调试TypeScript
中的VSCode
的教程和帖子。但是我每次都失败了。
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Node TS",
"preLaunchTask": "typescript",
"program": "node ${workspaceFolder}\\src\\app.ts",
"cwd": "${workspaceFolder}",
"protocol": "inspector",
"outFiles": ["${workspaceFolder}\\dist\\**\\*.js"]
}
]
}
task.json
{
"version": "2.0.0",
"tasks": [
{
"label": "typescript",
"type": "npm",
"script": "start-no-watch",
"problemMatcher": []
}
]
}
运行调试器时,它可以很好地运行服务器。但它从未达到任何断点。当停止服务器时,它会出错prelaunch terminated with exit code 1
,然后单击Show Errors
说No problem have been detected
。除了把头撞在墙上,我还做错什么?
注意:请不要将其标记为重复项。我曾尝试过其他帖子,但感觉好像缺少了一些我不知道的小东西。