Skip to content

Debugging Breakpoints not hit in mono repo with libraries #20950

@cluen

Description

@cluen

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, it was running before. Don't know the exact version (angular 10)

Description

Can't debug into library code with Visual Studio Code or Chrome Debugger. Breakpoints in the app-component.ts are hit but breakpoints in injected service don't. In previous versions of angular it was possible.

Found an stackoverflow article with the same problem, but without a solution / answer:
https://stackoverflow.com/q/67580325/5703479

🔬 Minimal Reproduction

Sample repo: https://github.com/cluen/ng-debug-library

> ng new ng-debug-library
> ng g library @lib-core/components
> ng b @lib-core/components --watch

add test-method to component.service.ts (e.g. console.log(1)) , 
inject and call test-method in app-component.ts

add breakpoint to app-component.ts method call, 
add breakpoint to component.service.ts content

in a different terminal
ng s

launch via visual studio code: F5 (launch.json will be autogenerated, edited content below)
{
  // Verwendet IntelliSense zum Ermitteln möglicher Attribute.
  // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
  // Weitere Informationen finden Sie unter 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}",
      "sourceMaps": true,
    }
  ]
}

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 11.2.13
Node: 12.16.1
OS: win32 x64

Angular: 11.2.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.13
@angular-devkit/build-angular   0.1102.13
@angular-devkit/core            11.2.13
@angular-devkit/schematics      11.2.13
@angular/cli                    11.2.13
@schematics/angular             11.2.13
@schematics/update              0.1102.13
ng-packagr                      11.2.4
rxjs                            6.6.7
typescript                      4.1.5

Anything else relevant?

Chrome: Version 90.0.4430.212
Operating System: Windows
Visual Studio Code Version: 1.56.2
Debugger for chrome: v4.12.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions