-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix: use acceptExports to support partial hmr #11453
Conversation
🦋 Changeset detectedLatest commit: b612177 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I remember rixo saying that it's possible to check for that and fall back to the regular accepts if the environment doesn't support acceptExports? That way we can potentially support more than vite hmr |
added a conditional, new output looks like this if (import.meta.hot) {
const s = $.source(App);
App = $.hmr(s);
if (import.meta.hot.acceptExports) import.meta.hot.acceptExports(["default"], (module) => {
$.set(s, module.default);
}); else import.meta.hot.accept((module) => {
$.set(s, module.default);
});
} |
vite-plugin-svelte 4 is ready for its first prerelease: sveltejs/vite-plugin-svelte#893 would be good if svelte 5 had this PR and #11456 landing soon so we can raise the minimum peer dep and users can enjoy inspector and hmr 🚀 |
improvement for hmr with vite-plugin-svelte. This requires a new version of vps to work so both
Svelte 5 rewrite
Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (
main
).If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is
svelte-4
and notmain
.Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint