Opt-in to disable page reload when using HMR

When HMR update fails, it forces a page reload.

This may be desirable for consistency, but most of the time this is caused by a simple syntax error, and I’d like to error to just appear in console. When I fix the error, another HMR update will come and “fix” the system anyway.

When react-hot-loader used a pitch loader, it just put HMR-updated require inside a try-catch.

Now that I refactored it to be a simple loader (no pitching), I no longer have the ability to catch syntax errors in the breaking module.

Can we have a way to disable page reloads altogether? I guess making it opt-in and logging something like “The system is in inconsistent state” is fine with me.

cc @syranide

Author: Fantashit

1 thought on “Opt-in to disable page reload when using HMR

  1. I agree; it’s also a matter of preference, as most of my team hate auto reloading. They’re used to refreshing when they feel like it. For stateful project, auto reloading is quite irritating. For them, HMR is a nice bonus when it’s possible, but not at the cost of constantly losing their state due to irrelevant edits.

Comments are closed.