-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
full page reload every server update, HMR, vite #9241
Comments
(Not a valid workaround) After digging into vite docs and vite forums, i found the vite config options to ignore typescript files vite.config.ts
but now there's no way to easily rebuild the server files other than restarting vite |
Ok, found an acceptable workaround thanks to this vite post from about a year ago. Included this in my +layout.svelte (Or any svelte file you wish to not to full page reload on server changes) +layout.svelte, or +page.svelte
All server file changes still compile however this prevents your front-end from completely reloading. |
You could also call |
Thanks so much, this really helped me preserving the form state while developing |
Putting |
Just add this to your client-side code: if (import.meta.hot) {
import.meta.hot.accept(() => {
import.meta.hot!.invalidate();
});
} It will force a full page reload for every HMR action. |
closing this now that vitejs/vite#7887 is resolved |
Describe the problem
Vite aggressively reloads the entire app every time there's a server change. API change? Reload. +page.server change? Reload.
Trying to test a big form for instance that constantly resets form values every time you save the action feels so bad.
Rich has this issue open vitejs/vite#7887
but the DX right now because of this is so bad that I beg we have a workaround.
Describe the proposed solution
Coerce someone at vite to address vitejs/vite#7887
or gives us a workaround
Alternatives considered
No response
Importance
i cannot use SvelteKit without it
Additional Information
No response
The text was updated successfully, but these errors were encountered: