webpack-hot-middleware
webpack-hot-middleware copied to clipboard
Force reload when server has restarted
When you have restarted the dev server and aren't using the reload option, you always can see these warnings in the dev console
[HMR] Cannot find update (Full reload needed)
[HMR] (Probably because of restarting the server)
for better DX, I would probably force reload the browser regardless. As default or with a new option, whatever.
An attempted workaround would be something ugly like
module.hot.addStatusHandler((status) => {
if (status === 'idle') {
window.location.reload()
}
})
But no, that's too bad and causes too many reloads.
I think if you set the client option reload=true, that is what happens?
Nope, I dont want to set that reload option. Because I need the module.hot.accept() API which wouldn't work then the whole page always gets reloaded.
But my issue is that, when the dev server has restarted, the page doesn't get reloaded when you haven't set the reload option although I want it to reload, only for this situation, nothing else.
Then the reload option is unclear, and possibly needs better documentation.
Reload means that if hot reloading cannot be applied, the page will be reloaded. If hot reloading can be applied, the page will not be reloaded.
Hmmm, yeah, that sounds like documentation needs to be clearer. Few more questions
- What does "If hot reloading can be applied" exactly mean?
- What are typical use cases when you do not want to apply
reload=true