无法调试我的ts-node express项目(忽略断点,因为找不到生成的代码)

时间:2017-03-06 14:35:17

标签: node.js express typescript

我将使用此项目express-typescript-starter,但是当我放置断点并在VS Code上启动调试时,他说"断点被忽略,因为找不到生成的代码(源映射问题?)。 #34;

launch.json

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "launch",
        "name": "Launch Program",
        "program": "${workspaceRoot}\\index.js",
        "cwd": "${workspaceRoot}"
    },
    {
        "type": "node",
        "request": "attach",
        "name": "Attach to Process",
        "port": 5858
    }
]

tsconfig.json

"compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "listFiles": false
},
"exclude": [
    "node_modules"
]

1 个答案:

答案 0 :(得分:0)

应该是必要的tasks.json使用tsc生成JS和JS.MAP文件。但我不知道为什么,因为我把断点放在TS文件上并对我有用......

"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"

使用解决方案的存储库:

https://github.com/bsalesc/express-typescript-starter/