Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
            ]
        }
    ]
}
like image 610
António Avatar asked Sep 19 '25 22:09

António


1 Answers

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

like image 133
António Avatar answered Sep 22 '25 13:09

António