Search code examples
typescriptvisual-studio-codefeathersjs

How to debug feathersjs with typescript on VS Code?


I want to debug a typescript feathersjs project using VSCode but when I launch the program a get the error

"Cannot launch program '[project_path]/src/index.ts' because corresponding JavaScript cannot be found. "

My launch.json look like this:

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

Solution

  • The typescript sourceMaps are not being generated.

    To fix this problem go to the tsconfig.json and add '"sourceMap": true' on the compilerOptions.

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