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

前端 未结 18 2613
无人共我
无人共我 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:32

    Setting "outFiles" : ["${workspaceRoot}/compiled/**/*.js"] solved the issue for me.

    "outFiles" value should match one set in tsconfig.json for outDir and mapRoot which is ${workspaceRoot} in your case, so try "outFiles": "${workspaceRoot}/**/*.js"

    Here are my tsconfig.json

    {
        "compilerOptions": {
            "module": "commonjs",
            "noImplicitAny": true,
            "removeComments": true,
            "preserveConstEnums": true,
            "sourceMap": true,
            "target": "es6",
            "outFiles": ["${workspaceRoot}/compiled/**/*.js"],
            "mapRoot": "compiled"
        },
        "include": [
            "app/**/*",
            "typings/index.d.ts"
        ],
        "exclude": [
            "node_modules",
            "**/*.spec.ts"
        ]
    }
    


    and launch.json

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "node",
                "request": "launch",
                "name": "Launch Program",
                "program": "${workspaceRoot}/compiled/app.js",
                "cwd": "${workspaceRoot}",
                "outDir": "${workspaceRoot}/compiled",
                "sourceMaps": true
            }
        ]
    }
    

    Here is small project, where you may see all parameters set https://github.com/v-andrew/ts-template

提交回复
热议问题