-
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
esbuild: Application rebuilding after files wrongfully were detected as changed #25197
Comments
@wartab, this should not be any different from the default webpack based builder. When a file is saved, even if the contents did not change a rebuild is triggered. |
I just tested it again. I can confirm what I reported. The behaviour is different with esbuild. |
I'm not sure how to help out with this. It's pretty easy to replicate on my end, so if you can tell me how to proceed, let me know. |
As mentioned, the default Webpack-based builder also will rebuild if a file is altered but does not have any content changes. The following steps can be used to demonstrate this:
As shown above, a rebuild is performed even though no input content is actually changed. |
It seems like I have been mislead by what the root cause of this is. I took the time to investigate what is happening and managed to find that this was all a side effect of having a JetBrains IDE open while doing my tests. All operations I described were either directly caused by the IDE or made the IDE react in a way I didn't expect. Specifically the example I mentioned: So the issue is more that the esbuild version watches more/other files than the webpack version. I can see that the naive way of not watching directories starting with a dot wouldn't work, as Webpack also watches those folders once those files are imported in source code. |
I can confirm I am seeing this also, but it seems totally random 😕 I had VS Code opened and cleared the terminal so I could keep an eye on it. All I did was click on my ".gitignore" file, just click it not change it, and I got "Changes detected. Rebuilding ...". Then I cleared the terminal and tried clicking other files, couldn't repro it ... until I clicked angular.json. Then it rebuilt again. package.json? No rebuild. Click some other files and then go back to package.json? Rebuild. If I clear the terminal and try clicking these files again to repro, it won't rebuild. No modifications were made to these files at all, it simply displayed them in the editor and this caused esbuild to trigger another rebuild. Is there anything special about these particular files that I'm missing? But it gets stranger ... Often it will rebuild when I switch away from, and then back to, the VS Code window. Sometimes. But not reproducable. It happened just now when I switched back to it, but when I tried it again it didn't rebuild the second time. Then, later in the day, I switched back to it and it rebuilt the project ... twice. One right after the other. Next, I went to clear the terminal again, so I clicked the three dots to get to the "Clear Terminal" window. Just clicking the three dots again caused it to rebuild. Just the opening of the menu. I'd almost think it's seeing some external program making some changes to these files but it is happening clearly as a result of actions I am taking. The console will be clear and exactly the moment I select a file, rebuild. The exact moment I open a menu, rebuild. That can't be a coincidence. |
it's quite annoying problem. sometimes it seems randomly rebuilding while viewing front end in the browser. thus triggering reload in the browser as well! Editor is vs code. seems like it changes cache or some config but angular esbuild treats it as file change in the project. |
Might be related to 7155cbe |
It does fix it, indeed. That said, and I realise it's a bit nitpicky, but that's not exactly the behaviour we had when not using esbuild, but I'm sure it doesn't affect the vast majority of projects:
|
We ran into this issue with files in the project directory. |
Addressed via #26182 |
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. |
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Sometimes, files will be detected as changed (I assume by chokidar), even if they haven't actually changed. This causes the application to rebuild.
This is not the case when not using esbuild.
Those file changes can be caused by multiple things, like git or WebStorm randomly deciding to writing files to disk that haven't been changed.
Minimal Reproduction
run ng serve
One way of replicating this behaviour in WebStorm is to press Ctrl + S even if the file hasn't changed.
Exception or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: