Vite 3 regression: missing reload after fixing import error existing on dev server startup #9534
Closed
7 tasks done
Labels
feat: deps optimizer
Esbuild Dependencies Optimization
feat: hmr
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
When spinning up the Vite dev server with code that contains an invalid import, an error is shown as expected. However, fixing the code does not cause the page to reload as it should. It needs to be reloaded manually.
This only seems to occur when the invalid import was present when the Vite dev server was first spun up. I suspect that's because Vite 3 doesn't set up the module graph in the same way as Vite 2 did, i.e. a file that contains a bad import isn't added to the module graph, so when that file is updated, Vite 3's dev server doesn't know about it and therefore no reload occurs.
I found out about it when upgrading Preview.js to Vite 3, as I have tests for that specific case. Yes, I'm considering adding it to the ecosystem test suite, but it's too flaky at the moment :)
Reproduction
https://github.com/fwouts/vite-not-refreshing (reproduction steps in README)
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: