You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@angular/build 20.1.0 totally breaks console logs line numbers in browser devtools #30731
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/....
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
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.
@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
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
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.
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.
Activity
hybrist commentedon Jul 16, 2025
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.
jpike88 commentedon Jul 17, 2025
This is something that broke in 20.1.0 for me. Logging my own issue as well, as it's a serious breaking change.
rostislavcz commentedon Jul 17, 2025
@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
wscherphof commentedon Jul 17, 2025
npm install @angular/[email protected]appears to serve as a workaround.[-]@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[/+]hybrist commentedon Jul 17, 2025
Can you confirm if this was with the application builder or with the browser builder? I just tried a naive reproduction with
ng newin version 20.1.0 and saw correct line numbers in DevTools.jpike88 commentedon Jul 18, 2025
This is with the application builder.
jpike88 commentedon Jul 18, 2025
jpike88 commentedon Jul 18, 2025
jpike88 commentedon Jul 18, 2025
Analyzing source output from 20.06 vs 20.1.0, I found a couple of key differences:
dombeing added as prefix to a bunch of different names like element -> domElement and template -> domTemplateclydin commentedon Jul 18, 2025
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.jpike88 commentedon Jul 18, 2025
I've isolated the problem version to
@angular-devkit/[email protected]. If I revert that library to20.1.0-next.2, the problem is not there anymore.hybrist commentedon Jul 18, 2025
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:
@angular/build)@angular/build)@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 servesource maps.Given that the build-angular change was in
terser, I want to ask explicitly: Is this duringng serveor when running with optimizations / prod code?11 remaining items
alan-agius4 commentedon Jul 21, 2025
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
importHelperis now being emitted on multiple lines, this causes the shift in sourcemaps.Version 7.0.0
Edit: I've opened an upstream issue: vitejs/vite#20454
ilyakonrad commentedon Jul 21, 2025
I noticed the "shift" too when debugging.
wscherphof commentedon Jul 24, 2025
Fix is released in vite v7.0.6 now.
hybrist commentedon Jul 24, 2025
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!
fix(@angular/build): update `vite` to `7.0.6`
fix(@angular/build): update `vite` to `7.0.6`
alan-agius4 commentedon Jul 24, 2025
Closed via #30781
angular-automatic-lock-bot commentedon Aug 24, 2025
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.