3

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"
            ]
        }
    ]
}
António
  • 435
  • 7
  • 17
  • Hah. For some reason, VS Code (latest version) generated it without the "preLaunchTask" line and output that error on my computer. I added that line and now it works. – Damn Vegetables May 25 '20 at 22:17

1 Answers1

2

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

KyleMit
  • 30,350
  • 66
  • 462
  • 664
António
  • 435
  • 7
  • 17