rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Feature]: HMR stops working if server is down when HMR is attempted

Open marco2216 opened this issue 1 year ago • 4 comments

System Info

System: OS: macOS 13.3.1 CPU: (8) arm64 Apple M1 Memory: 41.08 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.8.1 - ~/.nvm/versions/node/v20.8.1/bin/node npm: 10.1.0 - ~/.nvm/versions/node/v20.8.1/bin/npm Watchman: 2023.10.23.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 123.0.6312.58 Safari: 16.4

Details

It's not a rspack issue per se, it's from the webpack HMR source. If the request to get the updated manifest fails, we get stuck in the "check" status, which means that HMR will not work, even after the server is back up. This is quite annoying for our project because sometimes the server gets restarted at the same time as a HMR is attempted.

I think it could make sense to catch here, and set state to "idle", if the request fails?

Reproduce link

No response

Reproduce Steps

Run any dev server project with HMR, close server that serves files, update a file to trigger HMR. You should see something like this in console image

Now, notice that saving any file after this will not trigger any requests, because the status is not reset. In effect HMR is broken until the page is refreshed.

marco2216 avatar Mar 22 '24 13:03 marco2216