-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular 12.0.1 builds multiple times on startup and on file changes #20891
Comments
I just verified that this is also an issue with 12.0.0. Interestingly I have an another app on a Mac that was upgraded from 11->12 and it doesn't have the same issue as this one in windows. In relation to the #20882 I did have a svg in this app, but took it out and it still has the issue. I'm using powershell to launch the app |
If I run it in WSL/Ubuntu then it doesn't do the repeated rebuild. So my guess is it's something to do with windows file change detection |
@paulaustin-automutatio I run it on Ubuntu 21.04 and I got the same multiple build |
I had this problem and found out that it was because of an "error" in my angular.json file, does not have to be the same reason here but check to make sure that you do not have any "assets" in your angular.json that does not exist (I specifically had one of the glob pattern variety, not sure if it would do the same with normal assets) |
@Ristaaf I did have a missing css in the angular.json file, however removing that from both the browser and karma sections didn't fix the issue. Do you know if there is or is plans to add a "lint" type function for the angular configuration files to check validity? |
@paulaustin-automutatio, does the issue manifest itself if you disable polling? |
@alan-agius4 Yes if I just run ng serve without the poll option it compiles twice.
|
@alan-agius4 I'm running on Windows and assuming by polling you mean the With And with This is for |
@simeyla by polling I mean using the |
Thanks to @elvisbegovic who offered multiple team viewer sessions. I managed to get to the bottom of this and have PR in flight #20984 to address this. |
I believe this also breaks For a routed component, I was getting I did not see the issue when copying the project over to WSL2 under Ubuntu (where this bug is not present). I'm hoping this issue will cover it too. I think something gets corrupted and out of sync because the hot-update is generated before it's even served the original bundle. Reloading the browser doesn't fix it. |
This caused Webpack to mark all TypeScript files as removed after the first compilation on Windows because the file separators didn't match Closes #20891
@alan-agius4 When will this be released? It wasn't in 12.0.3? |
This fix is available in |
@alan-agius4 unfortunately this seems to still be occuring on 12.0.3. After the initial prompt to open my browser I get another build with a report on unchanged chunks. I created a new empty project with this sequence of commands, first verifying I'm on 12.0.3.
For an empty project the second build takes less than a second, but in my actual project it takes an additional 33 seconds, during which the URL does not respond. I'm happy to check anything else if you need, but this was easily repeatable on Windows 10 with a new project. Just for the record here is package.json for that project, but I made no changes to it:
And "C:\Temp\angular12\angular12-b\rebuildtest\node_modules@ngtools\webpack\package.json" does indicate 12.0.3 |
Does it happen when |
@clydin I ran it again and was about to say you're right... My own project seems to build twice every single time. So it may be some kind of race condition where a file is generated into the source tree and there's a 50/50 change it'll get picked up during that same build as a change. For a large build it would always get picked up, but for a trivial project it's hit or miss! It doesn't appear to be an odd/even issue because I just got three sequential builds with no rebuild. That's just a complete guess. It's actually my birthday today so I'm going to leave this for now, but if you have any other ideas I'll check as soon as I can :-) Thanks for the quick response. Here's some sample timings running 9318ms |
Thanks a lot @Ristaaf, this fixed the issue in our Angular application. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This caused Webpack to mark all TypeScript files as removed after the first compilation on Windows because the file separators didn't match Closes angular#20891
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: ....Yes 11
Description
Initial startup or changes to files result in multiple compilation and build tasks. Sometimes as many as 12. Resulting in the same number of refreshes in a browser. It doesn't matter if the browser is open or not.
🔬 Minimal Reproduction
The following shows the multiple compilation and build when starting the application and no changes to files were made.
I had upgraded the project from 11->12, deleted package lock/node modules and re-installed.
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: