Skip to content

Svelte 5: Hydration fails when SvelteKit app is run as a dependency #11376

Answered by dummdidumm
samlfair asked this question in Q&A
Discussion options

You must be logged in to vote

The error happens because there are two copies of the Svelte runtime in your app when running the application like this. To keep this from happening, add

	optimizeDeps: {
		exclude: ['svelte']
	},

to the Vite config of your package.

It still doesn't fully work because some package seems to be resolved incorrectly, but that is unrelated to Svelte.

In general it's not recommended to run an application indirectly from inside node_modules like this due to the pitfalls this approach has.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by samlfair
Comment options

You must be logged in to vote
1 reply
@dummdidumm
Comment options

Comment options

You must be logged in to vote
2 replies
@dummdidumm
Comment options

@samlfair
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #11220 on April 29, 2024 12:20.