Vite's HMR does not seem to fire correctly out of the box for projects running in WSL where the editor application is running in Windows.
It seems like potentially a docs fix - recommend that users on WSL run their editor out of WSL, or detecting a WSL environment in our vite config, and toggling usePolling. Does not seem like something we'd want to turn on by default.
Using Vite on Windows Subsystem for Linux (WSL) 2
When running Vite on WSL2, file system watching does not work when a file is edited by Windows applications (non-WSL2 process). This is due to a WSL2 limitation. This also applies to running on Docker with a WSL2 backend.
To fix it, you could either:
Recommended: Use WSL2 applications to edit your files.
It is also recommended to move the project folder outside of a Windows filesystem. Accessing Windows filesystem from WSL2 is slow. Removing that overhead will improve performance.
Set { usePolling: true }.
Note that usePolling leads to high CPU utilization.
Feature Description
Vite's HMR does not seem to fire correctly out of the box for projects running in WSL where the editor application is running in Windows.
It seems like potentially a docs fix - recommend that users on WSL run their editor out of WSL, or detecting a WSL environment in our vite config, and toggling
usePolling
. Does not seem like something we'd want to turn on by default.