VS Code: "Breakpoint ignored because generated code not found" error VS Code: "Breakpoint ignored because generated code not found" error javascript javascript

VS Code: "Breakpoint ignored because generated code not found" error


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


I came across this question while looking for a solution to a similar problem that I was having. Despite being different from OP's problem, it might help others.

Context: I was following the Visual Studio Code HelloWorld example and found myself unable to stop on break points.

I solved my problem by changing .vscode/launch.json so that "sourceMaps": true attribute under the Launch configuration was set (it starts default on false).


I think the problem might be in your 'program' section of launch.json. Try it like this:

{    // Name of configuration; appears in the launch configuration drop down menu.    "name": "Launch",    // Type of configuration.    "type": "node",    "request": "launch",    // Workspace relative or absolute path to the program.    "program": "${workspaceRoot}/app.ts",    // Automatically stop program after launch.    "stopOnEntry": false,    // Command line arguments passed to the program.    "args": [],    // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.    "cwd": "${workspaceRoot}",    // Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.    "runtimeExecutable": null,    // Optional arguments passed to the runtime executable.    "runtimeArgs": ["--nolazy"],    // Environment variables passed to the program.    "env": {        "NODE_ENV": "development"    },    // Use JavaScript source maps (if they exist).    "sourceMaps": true,    // If JavaScript source maps are enabled, the generated code is expected in this directory.    "outDir": "${workspaceRoot}"}