'Unable to hit breakpoint in VS Code with Angular 13
Below is my launch.js
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
}
In launch.js, I have tried changing webRoot to "webRoot": "${workspaceFolder}/src", it didn't have an impact.
My App is up and running with ng serve, yet when I hit F5 to start the debug mode, none of the breakpoints are hit and they are all unbound/greyed out.
Below is my angular.js in case anyone needs it.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-u-project-one": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular-u-project-one",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": false,
"outputHashing": "all",
"sourceMap": true,
"namedChunks": true,
"extractLicenses": false,
"vendorChunk": true,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-u-project-one:build"
},
"configurations": {
"production": {
"browserTarget": "angular-u-project-one:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-u-project-one:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular-u-project-one:serve"
},
"configurations": {
"production": {
"devServerTarget": "angular-u-project-one:serve:production"
}
}
}
}
}},
"defaultProject": "angular-u-project-one"
}
Below is my folder structure:
What else can be done to make it work?
Thank you.
Solution 1:[1]
I had the same problem, updating from Angular 11 to 13, then i found some helping and did the following steps in my proyect:
1.- Edit the : angular.json file.
Add the following lines (sourceMap and optimization) into respective section or environments, by example :
"configurations": {
.......
.......
.......
"dev" : {
"sourceMap": true,
"optimization": false,
..... // More code
},
"devlocal" : {
"sourceMap": true,
"optimization": false,
..... // More code
}
}
2.- Restart your angular application. 3.- Put your break points in your component. 4.- Debug your application with chrome or visual studio code.
And that's it !!!
It works forme. :)
Greets !!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marco Antonio |

