Angular-cli: Webpack constantly recompiling

Created on 10 Mar 2017  路  9Comments  路  Source: angular/angular-cli

Please provide us with the following information:

OS?

Win 10

Versions.

$ ng --version
@angular/cli: 1.0.0-rc.1
node: 6.9.4
os: win32 x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

Repro steps.

Whilst running ng serve --host 0.0.0.0, webpack sometimes decides to inexplicably go crazy and recompile constantly, even though no files have changed.

I can't figure a trigger pattern - it just seems to do it randomly; sometimes it refreshes once, other times it refreshes 50 times in a row then settles for a bit. Once webpack has finished it's frenzy, my browsers all refresh. As you can imagine, this makes testing really difficult as browsers sometimes refresh in the middle of form input.

Things I think it might be (clutching at straws):

  • It might be triggered when a new npm package is recently added, though I can't confirm this
  • It may also be related to when there is an error in the project (though there are currently no errors in the project, and it's going crazy atm)
  • It may be triggered when I am focusing on another browser window (it's going crazy while I type this)

Restarting ng serve does not always rectify the issue, but it seems to eventually make it workable if I do it enough.

Gif of the repro here:

https://www.dropbox.com/s/as67bk4wt3b2b0n/webpack.recompile.gif?dl=0

I have recently upgraded angular cli, but this issue was occurring before the upgrade too.

The log given by the failure.

No error, just unexpected behaviour.

Mention any other details that might be useful.

I can provide a full zip of my project to see if you can reproduce it, but not publicly - please let me know if there's a secure place to upload.

What I tend to do is:

  • npm / yarn start (happens regardless of which I use)
  • work on project
  • Issue will start to occur at some point

It's also worth mentioning that I'm running ng serve via git bash (MingW64) in a ConEmu wrapper, though this has also happened in a raw git bash window.

more info

Most helpful comment

@Bidthedog thanks for getting back on this 馃憤

All 9 comments

Do you get the same behavior just using a normal Windows command prompt? Any chance your IDE or some other application is writing files into your project structure?

I will try a normal cmd prompt next time I'm on with it. I'm using VSCode - not aware of it writing anything into the project folder, but I'll stick ProcMon on there next time it happens and check.

OK, this looks to be related to my backup reading files from my git dir. Git dir excluded from backup, I'll report back in a day or so.

I am seeing the same behavior but I noticed that it only occurs when I run "ng serve --ssl" and only on windows 10 (same project does not experience this erratic rebuilding when I run ng serve --ssl on mac.)

I am using the latest vscode with autosave enabled on both platforms and an ng new generated project after installing angular 4.0.0.

At first I thought it could be related to autosave but I always use this feature and when I run ng serve without the ssl flag I do not see this rebuilding problem.

I am also running ng serve from the node.js cmd prompt (the one that shows up after node.js installation with the cmd prompt icon and "node.js command prompt" title not the one that has the node.js icon and no title)

Sorry guys, forgot to report back - I can confirm that I'm no longer getting the issue now I've excluded my project folder from my backup.

@Bidthedog thanks for getting back on this 馃憤

Wow. This drove me crazy. I'm new to Anglar, only now doing a 1st project from a tutorial.
Suddenly my live preview started to keep refreshing over and over again and I didn't knew what was wrong.

Yup. It was Backblaze reading & uploading the files from that director. :)

This happened to me when I was serving the app on two browsers at once. Closing one resolved the issue for me.

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._

Was this page helpful?
0 / 5 - 0 ratings