Update Vite and vite-plugin-svelte (proper fix for hydration issue?) #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Well... this is embarrassing. This was the much simpler (and probably more "correct") fix for datocms/datocms-svelte#14 (the svelte:head hydration issue).
We just needed to upgrade
vite
andvite-plugin-svelte
to the next major versions, which is what the official Svelte demo uses.What we had:
What the official demo has:
(from https://github.com/sveltejs/cli/blob/main/packages/create/templates/minimal/package.template.json)
Upgrading those (after deleting the lockfile and regenerating it) fixed the hydration issue, even with
[email protected]
. So I guess that PR was unnecessary and the if-then inside the head worked fine as it was =(Sorry about that. I spent a bit trying to create a minimal example for Svelte but couldn't, then started to investigate package versions. I didn't look into this previously because I thought whoever upgraded that starter to Svelte 5 probably did the same for the other libs... apparently not yet lol.