Skip to content

fix: no longer read kit.browser.hydrate #496

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

Merged
merged 1 commit into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/flat-shrimps-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/vite-plugin-svelte': patch
---

simplify init of compilerOptions.hydratable for kit (kit.browser.hydrate is no longer in use)
17 changes: 3 additions & 14 deletions packages/vite-plugin-svelte/src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,9 @@ function removeIgnoredOptions(options: ResolvedOptions) {
// some SvelteKit options need compilerOptions to work, so set them here.
function addSvelteKitOptions(options: ResolvedOptions) {
// @ts-expect-error kit is not typed to avoid dependency on sveltekit
if (options?.kit != null) {
// @ts-expect-error kit is not typed to avoid dependency on sveltekit
const kit_browser_hydrate = options.kit.browser?.hydrate;
const hydratable = kit_browser_hydrate !== false;
if (
options.compilerOptions.hydratable != null &&
options.compilerOptions.hydratable !== hydratable
) {
log.warn(
`Conflicting values "compilerOptions.hydratable: ${options.compilerOptions.hydratable}" and "kit.browser.hydrate: ${kit_browser_hydrate}" in your svelte config. You should remove "compilerOptions.hydratable".`
);
}
log.debug(`Setting compilerOptions.hydratable: ${hydratable} for SvelteKit`);
options.compilerOptions.hydratable = hydratable;
if (options?.kit != null && options.compilerOptions.hydratable == null) {
log.debug(`Setting compilerOptions.hydratable = true for SvelteKit`);
options.compilerOptions.hydratable = true;
}
}

Expand Down