evidence icon indicating copy to clipboard operation
evidence copied to clipboard

HMR support for Windows Subsystem for Linux Users

Open mcrascal opened this issue 2 years ago • 1 comments

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.

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.

mcrascal avatar Nov 17 '23 13:11 mcrascal

It doesn't work

Sinsstranger avatar Dec 18 '23 17:12 Sinsstranger

Works fine now

archiewood avatar Aug 14 '24 20:08 archiewood