【问题标题】:Can't debug my ts-node express project (Breakpoint ignored because generated code not found)无法调试我的 ts-node express 项目(断点被忽略,因为找不到生成的代码)
【发布时间】:2017-03-06 14:35:16
【问题描述】:

我将使用这个项目express-typescript-starter,但是当我在 VS Code 上设置断点并开始调试时,他说“断点被忽略,因为找不到生成的代码(源映射问题?)。”

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"
]

【问题讨论】:

    标签: node.js express typescript


    【解决方案1】:

    应该是必需的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/

    【讨论】:

      猜你喜欢
      • 2018-01-19
      • 1970-01-01
      • 2016-06-30
      • 2018-01-06
      • 1970-01-01
      • 2023-04-05
      • 2021-11-05
      • 1970-01-01
      • 2018-06-24
      相关资源
      最近更新 更多