vscode-js-debug icon indicating copy to clipboard operation
vscode-js-debug copied to clipboard

Unbound breakpoint in VS Code when serving a different configuration

Open jaadh opened this issue 6 years ago • 6 comments

Describe the bug

My issue

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

Currently when I serve the application e.g. ng serve my breakpoints are bound and the breakpoints get hit:

enter image description here

However, when I serve via a different configuration e.g. ng serve -c qa or ng serve -c uat the breakpoints become unbound:

enter image description here

Is there a reason why the breakpoints become unbound? How can I get the breakpoints to hit when serving with different environment configurations?

To Reproduce Steps to reproduce the behavior:

  1. Set a breakpoint in a .ts file where the breakpoint, in theory, should be bound
  2. ng serve -c ENVIRONMENT
  3. Observe that the breakpoint becomes unbound

Log File

N/A

VS Code Version:

2020.10.2217

Additional context

launch.json configuration:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "url": "http://localhost:4200",
      "webRoot": "${workspaceFolder}"
    }
  ]
}

Sample environment configuration angular.json:

"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:

jaadh avatar Dec 01 '20 11:12 jaadh

I see that you have "sourceMap": false,. Without sourcemaps we cannot map source location to their compiled locations, or vise versa. Let us know if you have any other issues.

connor4312 avatar Dec 01 '20 15:12 connor4312

Thanks, I should have spotted that, sorry to waste your time.

jaadh avatar Dec 01 '20 15:12 jaadh

Thanks for asking the question. It saved time for me! :)

banyanscott avatar Dec 17 '20 23:12 banyanscott

I am using Angular 15 and Node 18. I have the same issue but my "sourceMap" under development configuration is "true", yet breakpoints are unbound.

`"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kb",
                  "maximumError": "1mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "development"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "savings-app-osiris:build:production"
            },
            "development": {
              "browserTarget": "savings-app-osiris:build:development"
            }
          },
          "defaultConfiguration": "development"
        }
      }`

Vitruvius21 avatar Feb 25 '23 08:02 Vitruvius21

@Vitruvius21 I have the same issue

SirZanty avatar Mar 15 '23 21:03 SirZanty

I have the same issue

bchaitanus avatar Oct 03 '23 22:10 bchaitanus