I forked (not ejected) Create React App 5 and have modified it slightly to fit my application: I change PUBLIC_URL to be file://build/ (I have an Electron app that loads a HTML file using file:// but that shouldn't make any difference).
When I do this, when I edit a file while webpack-dev-server 5 is running, webpack 5's Hot Module Replacement infinitely reloads the window instead of just reloading the window once.
I looked into the sourcecode for HMR and when the webpack-dev-server client loads it gets the current hash of the bundle, then HMR tells the client about a new hash, it then does a comparison and if it's different, it triggers either a HMR replacement or a full page reload (which happens to me because it's my src/index file).
For some reason the initial hash is never updated to the new hash so when it does the comparison it always fails, so infinitely reloads.
Why is this happening? I should be able to change PUBLIC_URL to anything with a slash at the end of it.