New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR not working in WSL2 #5878
Comments
My patch #5617 probably addresses this. |
See https://vitejs.dev/config/#server-watch
|
"When running Vite on Windows Subsystem for Linux (WSL) 2, if the project folder resides in a Windows filesystem, you'll need to set this option to { usePolling: true }." This is talking about if your project folder is on the Windows side not the Linux side. In my case I'm following the recommendation of WSL2 and VSCode and have my projects located under my Linux root. This make everything very performant. Still need a solution to the bug I posted. |
So the file system watcher works but the browser doesn't update? |
I'm not familiar with WSL2, but it could be a network issue given that |
Your right, the HMR update was logged to the terminal but only each time I saved the file. There was no automatic update to the browser between saves. Here is what the browser console outputs: client.ts:22 [vite] connecting... The last line updates each time I save the file, same as the terminal does. |
That was the solution, thanks for your help. You might like to mention this in the docs as well, since I always look there for possible solutions first. |
Describe the bug
After installing the Vite Vue Template under the WSL2 home dir HMR does not work. The only way to see changes in the page loaded by NPM RUN DEV is to save the file, which then refreshes the page. In comparison, the online example at Stackblitz will refresh with every change without needing to first save the file.
When testing with the --debug flag only the first change was refreshed on a save and subsequent changes and save had no result. All I'm doing is changing a few letters to test that Vite works and it is not working as expected.
Reproduction
There are a few past issues that seem to face a similar problem. After trying any suggests those dated issues made the HMR still does not work on my setup.
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: