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
No HMR/Refresh on WSL #6043
Comments
|
Hey @royanger, when you're running the dev server in WSL, is your project also inside the linux filesytem or is it left behind in the regular windows filesystem? If the latter, then this is a bug in WSL: microsoft/WSL#4739 You might be able to work around this using export default defineConfig({
vite: {
server: {
watch: {
usePolling: true,
},
},
},
}); |
|
I didn't even think that would affect things, to be honest. I was running it out of /mnt/, so that's the Windows filesystem. Let try what you suggested and see if that helps at all. |
|
The astro.config.mjs suggestion worked perfectly. Thanks for that @mayank99! |
|
Thanks for the assist, @mayank99! Since this is an upstream issue that we can't help with, I'm going to close this, but definitely keep an eye on microsoft/WSL#4739 to track. See the Vite docs for more context! |
Thanks for the solution, worked in astro 3.0.5 using WSL & pnpm |


What version of
astroare you using?2.0.2
Are you using an SSR adapter? If so, which one?
Default install
What package manager are you using?
pnpm and npm
What operating system are you using?
Windows WSL2 Ubuntu
Describe the Bug
NOTE: I have included a Stackblitz line as I needed to in order to open this, but it doesn't repro the problem since this is limited to QSL
Steps to repro:
pnpm create astro@latestcdinto the projectpnpm devto start the projectThe page doesn't refresh, and if I manually refresh the change it not reflected. In order to see the change I need to kill the dev server and restart.
After this I can do the following:
rm -fr node_modules pnpm-lock.yamlpnpm iandpnpm devNow the page auto refreshes and the change is immediately displayed.
The same issue occur when using npm with WSL, and npm works fine with Powershell/non-WSL. IE, creating and running the app with npm on WSL results in no refresh on save, and after deleting the mode_modules and package-lock.json on WSL and running
npm iandnpm run devon Powershell refresh works.WSL info:
WSL Version: 22.04.1 LTS
pnpm 7.25.1
node 18.13.0
npm 8.19.3
Windows
pnpm 7.22.0
npx envinfo --system --binaries
System:
OS: Windows 10 10.0.22621
CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900KF
Memory: 44.71 GB / 63.82 GB
Binaries:
Node: 18.13.0 - C:\Program Files\nodejs\node.EXE
npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-suvaf6?file=src/pages/index.astro
Participation
The text was updated successfully, but these errors were encountered: