-
-
Notifications
You must be signed in to change notification settings - Fork 115
Improve handling of compilerOptions.hydratable #120
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
Comments
Sounds fine to me as long as we specify a default of true in SvelteKit still |
Explicit compilerOptions.hydratable in kit is a good idea if #121 doesn't work out. It would work even with the current version of kit as it sets That check isn't ideal (false positive if the config value is set but ssr isn't used), but the more correct/strict check const isSSR = !!(viteEnv.command === 'serve' ? viteConfig.server.middlewareMode : viteConfig.build.ssr); would be false for the build of client bundle, where hydratable is needed. |
I never realized |
turns out i was wrong. the kit client build does not set it, and it breaks as expected. So this change would require kit to explicitly set it. |
PR in kit to set hydratable: sveltejs/kit#2024 using viteConfig.ssr turned out to be not the best idea as this is not always set when hydratable is needed. So instead of adding an automatic default that only works half of the time, vite-plugin-svelte will default to |
Describe the problem
Currently vite-plugin-svelte defaults to
hydratable: true
which is not the default for svelte and mostly due to the reason that it reliably works with and without ssr.In situations where you don't use ssr and/or don't need clientside hydration, this leads to increased output size.
Describe the proposed solution
Only compile with
hydratable: true
when one of the following is trueAlternatives considered
stick with the current default. Users that want
hydratable: false
should set it in svelte config.Importance
nice to have
The text was updated successfully, but these errors were encountered: