nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
290 stars 159 forks source link

[dev] hot-reloading broken #1737

Closed jameshadfield closed 5 months ago

jameshadfield commented 5 months ago

Running auspice develop ... works fine initially, but as soon as the code rebuilds it is no longer viewable in the browser. Firefox displays "The page isn’t redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete". It looks like we're getting into a infinite loop of 302 redirects to the same page ("/").

How to reproduce

Steps to reproduce the current behavior:

  1. auspice develop
  2. load localhost:4000 - note that all works as expected
  3. Change some code, you should see "webpack building..." in the terminal
  4. Refresh localhost:4000

Possible solution

The bug is present at current master (40befc6ea4ac02226db2f5658faa12beda52a3e1). Bisecting indicates the bug was introduced in #1733

victorlin commented 5 months ago

I haven't looked at this in depth yet but we can just revert 798f3ee4289113f3094440f8fd96464686862591 for the time being. It's not an important change

victorlin commented 5 months ago

Seems to be weird interaction between Hot Module Replacement and output.clean. A search led me to https://github.com/webpack/webpack-dev-middleware/issues/861. Using CleanWebpackPlugin is a known workaround. I'll make a PR to revert.