VS Code: “Breakpoint ignored because generated code not found” error

前端 未结 18 2618
无人共我
无人共我 2020-12-13 08:07

I have looked everywhere and I still have issue debugging TypeScript inside VS Code. I have read this thread but still I am not able to hit my breakpoints placed inside a Ty

18条回答
  •  遥遥无期
    2020-12-13 08:50

    Facing the same issue and solved it by correcting the path to .ts files.
    My project contains src and dist dirs and the problem was that the generated .map files didn't have the correct path to the src dir.

    The fix - tsconfig.json:

    {
        "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "sourceMap": true,
            "outDir": "dist",
            "sourceRoot": "../src"
        }
    }
    

    Initially, my sourceRoot was pointing to src and there is no src dir inside dist.

    Also, sourceMaps should be set to true inside launch.json.

提交回复
热议问题