【问题标题】:How to debug feathersjs with typescript on VS Code?如何在 VS Code 上使用 typescript 调试feathersjs?
【发布时间】:2020-01-01 20:47:27
【问题描述】:

我想使用 VSCode 调试 typescript feathersjs 项目,但是当我启动程序时出现错误

“无法启动程序 '[project_path]/src/index.ts' 因为 找不到对应的 JavaScript。 "

我的 launch.json 如下所示:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/src/index.ts",
            "preLaunchTask": "tsc: build - tsconfig.json",
            "outFiles": [
                "${workspaceFolder}/lib/**/*.js"
            ]
        }
    ]
}

【问题讨论】:

  • 哈。出于某种原因,VS Code(最新版本)在没有“preLaunchTask”行的情况下生成了它,并在我的计算机上输出了该错误。我添加了那条线,现在它可以工作了。

标签: typescript visual-studio-code feathersjs


【解决方案1】:

没有生成打字稿源地图。

要解决此问题,请转到tsconfig.json 并在compilerOptions 上添加'"sourceMap": true'

{
  "compilerOptions": {
    "target": "es2018",
    "module": "commonjs",
    "outDir": "./lib",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true,
    "sourceMap": true
  },
  "exclude": [
    "test"
  ]
}

【讨论】:

    猜你喜欢
    • 2021-12-19
    • 2016-11-01
    • 2021-06-23
    • 2017-06-24
    • 2017-10-31
    • 2018-05-13
    • 1970-01-01
    • 2022-01-19
    • 2021-10-05
    相关资源
    最近更新 更多