dohpaz42
dohpaz42

Reputation: 528

Delay/Debounce Browser Reloading Angular2

Back-story: over the years, I've developed the habit of saving very frequently as I code; as such, it's second-nature that I save after just about every change I make. In fact, it's a conscientious effort not to save so frequently.

With that said, I'm looking to see if there is an option I can add to my configuration (presumably the angular-cli.json) that would allow me to customize a delay between file saving and reloading the browser. It gets a little old to save two or three times, and then the browser reloads two or three times.

I have tried looking at the poll configuration option, but that does not seem to do much for delaying reloading the browser. If I'm not mistaken, that's more of a delay between checking for file changes.

Disclaimer: I do understand that webpack a) can be ejected, allowing me to manually manage it's set up, and 2) has plugins that would allow me to do what I'm looking to do. The thing is, I'd prefer not to eject my webpack config if I can avoid it. My rationale is that I already have a full plate of application features I need to get done, and adding the time and learning curve to customizing webpack is not one of them right meow.

TIA.

Upvotes: 2

Views: 276

Answers (1)

dohpaz42
dohpaz42

Reputation: 528

After digging through both angular-cli's code, as well as webpack's configuration, I think it's safe to say that sadly, no, angular-cli does not [currently] support customizing the delay between file changes and browser reloading.

Instead of "living with it" or "stop using ng serve", as otherwise suggested, I decided to pick door #3 and open a ticket with angular-cli's issue tracker and ask that they add support for the watchOptions.aggregateTimeout property.

If you feel this would be a worthwhile configuration option, please vote for the issue.

Upvotes: 4

Related Questions