angulargoogle-chromevisual-studio-codevscode-debuggerangular10

Unbound breakpoint - VS Code | Chrome | Angular


I have an Angular application that I am trying to debug in VS Code.

When I compile and run the application (ng serve) the breakpoints are bound:

enter image description here

However, when I specify a different configuration e.g. -c qa or -c uat they are unbound:

enter image description here

  1. Why are the breakpoints unbound when I specify a different configuration?
  2. How do I bind the breakpoints for a debug session targeting a particular environment?

Relevant information

angular.json sample environment configuration:
"uat": {
  "fileReplacements": [
    {
      "replace": "src/environments/environment.ts",
      "with": "src/environments/environment.uat.ts"
    }
  ],
  "optimization": true,
  "outputHashing": "all",
  "sourceMap": false,
  "extractCss": true,
  "namedChunks": false,
  "extractLicenses": false,
  "vendorChunk": false,
  "buildOptimizer": true,
  "budgets": [
    {
      "type": "initial",
      "maximumWarning": "2mb",
      "maximumError": "5mb"
    },
    {
      "type": "anyComponentStyle",
      "maximumWarning": "6kb",
      "maximumError": "10kb"
    }
  ]
},
Software versioning:

Solution

  • The fix for this was simple, I hadn't set the sourceMap property to true in angular.json for that particular environment, instead I had "sourceMap": false,

    See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/SourceMap for more info.

    With thanks to Connor - https://github.com/microsoft/vscode-js-debug/issues/872