Skip to content

@angular/build 20.1.0 totally breaks console logs line numbers in browser devtools #30731

Closed

Description

@rostislavcz

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Hello,

after upgrading to minor version of @angular/build, whenever in my app I use console.log, in console it shows totally random line of code, for example i put console.log in my main.ts file on line 6 and in chrome devtool console, there is line 15 for example, before I used 20.0.3 version and that worked totally fine. Sometimes also happens that certain console logs are in console written as totally another file, for example I console.log something in my Directive1 and inside console log is shown in Directive2 on different line.

Took me several hours before i found that problem is definitely somewhere inside minor update of @angular/build/....

downgrade to @angular/[email protected] works as expected

Minimal Reproduction

just run any angular project with several services and you will see, that if you console.log in some service, lets say in constructor, in devtool console, you will see different line or even file

Exception or Error


Your Environment

@angular-devkit/architect    0.2001.1
@angular-devkit/core         20.1.1
@angular-devkit/schematics   20.1.1
@angular/build               20.1.1
@angular/cdk                 20.1.2
@angular/google-maps         20.1.2
@angular/material            20.1.2
@schematics/angular          20.1.1
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else relevant?

No response

Activity

  1. added
    needs: repro steps
    on Jul 16, 2025
  2. hybrist commented on Jul 16, 2025

    @hybrist
    Contributor

    Just clarifying: Is this really related to 20.1.1? I'm asking because it was released just an hour ago, so it seems unlikely that it was what got debugged for several hours. Was this something that already happened in 20.1.0 but is still broken in 20.1.1?

    Can you share a minimal reproduction of the issue? Without a reproduction we can run, it'll be hard to verify the issue. There's many ways to configure an Angular project and this may not affect all of them.

  3. jpike88 commented on Jul 17, 2025

    @jpike88

    This is something that broke in 20.1.0 for me. Logging my own issue as well, as it's a serious breaking change.

  4. rostislavcz commented on Jul 17, 2025

    @rostislavcz
    Author

    @jkrems sorry for misunderstanding, was too late and I was very tired :D tried it now, untill 20.0.6 its ok after 20.1.0 its broken as @jpike88 also reporting.

    I will try to leave here minimal reproduction repo in the evening today if necessary, but I guess this would not be hard to reproduce if you take any larger angular project and put to some services constructors or anywhere else some console.logs, probably you will that line numbers are not right

  5. wscherphof commented on Jul 17, 2025

    @wscherphof

    npm install @angular/[email protected] appears to serve as a workaround.

  6. changed the title [-]@angular/build 20.1.1 totally breaks console logs line numbers in browser devtools[/-] [+]@angular/build 20.1.0 totally breaks console logs line numbers in browser devtools[/+] on Jul 17, 2025
  7. hybrist commented on Jul 17, 2025

    @hybrist
    Contributor

    Can you confirm if this was with the application builder or with the browser builder? I just tried a naive reproduction with ng new in version 20.1.0 and saw correct line numbers in DevTools.

  8. jpike88 commented on Jul 18, 2025

    @jpike88

    This is with the application builder.

  9. jpike88 commented on Jul 18, 2025

    @jpike88
  10. jpike88 commented on Jul 18, 2025

    @jpike88
  11. jpike88 commented on Jul 18, 2025

    @jpike88

    Analyzing source output from 20.06 vs 20.1.0, I found a couple of key differences:

    • dom being added as prefix to a bunch of different names like element -> domElement and template -> domTemplate
    • ɵɵreplaceMetadata seems to have a different order of items in it (but the same items)...
    • source map base64s seem to be almost identical except for change in about 10-20 characters
  12. clydin commented on Jul 18, 2025

    @clydin
    Member

    If providing a minimal reproduction is problematic or even not possible, narrowing down the root cause would be aided by attempting to use the prerelease versions to determine when the problem for your projects occurred. For 20.1, the prerelease versions were: 20.1.0-rc.0, 20.1.0-next.3, 20.1.0-next.2, 20.1.0-next.1, 20.1.0-next.0.

  13. jpike88 commented on Jul 18, 2025

    @jpike88

    I've isolated the problem version to @angular-devkit/[email protected]. If I revert that library to 20.1.0-next.2, the problem is not there anymore.

  14. hybrist commented on Jul 18, 2025

    @hybrist
    Contributor

    Looking at https://github.com/angular/angular-cli/compare/20.1.0-next.2..20.1.0-next.3, there's some bundling related version bumps in:

    • rollup goes from 4.43.0 to 4.44.0 (@angular/build)
    • vite goes from 6.3.5 to 7.0.0 (@angular/build)
    • terser goes from 5.42.0 to 5.43.1 (@angular-devkit/build-angular)

    Code changes seem limited to unit tests, SSR, CSS, and MCP. None of which seem likely to have a side effect on ng serve source maps.

    Given that the build-angular change was in terser, I want to ask explicitly: Is this during ng serve or when running with optimizations / prod code?

  15. 11 remaining items

  16. added
    freq1: low
    and removed on Jul 21, 2025
  17. alan-agius4 commented on Jul 21, 2025

    @alan-agius4
    Collaborator

    Thanks for the reproduction, I had a quick look at this and it does appear that this issue is caused by the bump of vite to 7.0.0.

    It appears that the cause is that importHelper is now being emitted on multiple lines, this causes the shift in sourcemaps.

    Version 7.0.0

    const interopHelper = (m$2) => m$2?.__esModule ? m$2 : {
    	...typeof m$2 === "object" && !Array.isArray(m$2) || typeof m$2 === "function" ? m$2 : {},
    	default: m$2
    };

    Edit: I've opened an upstream issue: vitejs/vite#20454

  18. ilyakonrad commented on Jul 21, 2025

    @ilyakonrad

    I noticed the "shift" too when debugging.

  19. wscherphof commented on Jul 24, 2025

    @wscherphof

    Fix is released in vite v7.0.6 now.

  20. hybrist commented on Jul 24, 2025

    @hybrist
    Contributor

    The fix should be pulled in with the next dep bump in #30770. Only holdup is that Windows CI is currently down which makes landing changes tricky.

    Thanks for the report and the help tracking this down!

  21. added a commit that references this issue on Jul 24, 2025
    8811d7f
  22. added a commit that references this issue on Jul 24, 2025
    ea5cd0e
  23. alan-agius4 commented on Jul 24, 2025

    @alan-agius4
    Collaborator

    Closed via #30781

  24. angular-automatic-lock-bot commented on Aug 24, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  25. locked and limited conversation to collaborators on Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions