【发布时间】:2018-11-21 02:15:01
【问题描述】:
我正在尝试在 VS Code (v. 1.24.0) 中调试 Node/Express TypeScript 应用程序,并且在调试期间我的所有断点都显示为灰色。
错误是“未验证的断点,已设置断点但尚未绑定。”我已经搜索过,但无法弄清楚我的配置有什么问题。控制台没有错误,我选择进程时调试器附加成功,但是断点不起作用。
如何调试?
基本文件夹结构:
/.vscode
/src/server.ts
/dist/server.js
launch.json
tsconfig.json
launch.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"
]
}
tasks.json
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
}
} ]
【问题讨论】:
-
他们是否一直处于灰色状态?文件尚未编译/渲染的好变化。您是否尝试过一些 typescript 的源地图配置,您使用的是 webpack 吗?
-
我还要补充一点,这很可能不是 VS Code 问题。更多的配置在某个地方。
-
@DylanWright 同意了。我只是找不到正确的配置。是的,它们保持灰色。是的,我已经尝试过打字稿配置。不,不使用 webpack。
标签: node.js typescript express debugging visual-studio-code