Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 12 Debug source code not available in Chrome Developer tools was fine in Angular 11

I have 2 similar projects on 2 different laptops. The first project is written with Angular 11 and debugs fine with WebPack cloud icons in the source tab of developer tools showing so I can locate the source code and set breakpoints...

The 2nd project written with Angular 12.0.1 does not show any WebPack icons. I have read other similar questions and it looks like the angular.json has all the correct settings for development (e.g. sourceMap true, optimization false, defaultConfiguration development...) but it still looks like a production build in Chrome's development tools.

I've also tried doing an ng serve --configuration development

but still no luck. Is there something I'm missing so I can debug the V12 project?

like image 889
user3253156 Avatar asked May 26 '21 13:05

user3253156


Video Answer


2 Answers

I had the same problem and found that I had to add sourceMap and optimization entries to the development configuration.

 "configurations": {
        "development":{
          "sourceMap": true,
          "optimization": false
        },
        "production": {

Build using: ng build --configuration development

and it now works for me.

like image 118
Declan Avatar answered Nov 10 '22 17:11

Declan


I had the same problem after updating an Angular 11 app to Angular 12 (and then to 13). I use ng serve to debug my angular code.

Therefore I had to add

"development": {
  "browserTarget": "<App-Name>:build:development"
}

under "serve" / "configurations" beside the production configuration in angular.json.

Now I can debug with

ng serve --configuration development
like image 29
Philipp Schmid Avatar answered Nov 10 '22 15:11

Philipp Schmid