From 93fe7adcc14b523e6648278ee26ecc3ffc83c6b2 Mon Sep 17 00:00:00 2001 From: dominikg Date: Tue, 27 Jul 2021 22:14:14 +0200 Subject: [PATCH 1/2] [feat] explicitly set compilerOptions.hydratable to config.kit.ssr --- .changeset/nervous-items-kiss.md | 5 +++++ packages/kit/src/core/build/index.js | 10 ++++++++-- packages/kit/src/core/dev/index.js | 5 ++++- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 .changeset/nervous-items-kiss.md diff --git a/.changeset/nervous-items-kiss.md b/.changeset/nervous-items-kiss.md new file mode 100644 index 000000000000..5ff2230b63fc --- /dev/null +++ b/.changeset/nervous-items-kiss.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +explicitly set compilerOptions.hydratable to config.kit.ssr diff --git a/packages/kit/src/core/build/index.js b/packages/kit/src/core/build/index.js index b960d3f14cdf..26fc7801c541 100644 --- a/packages/kit/src/core/build/index.js +++ b/packages/kit/src/core/build/index.js @@ -174,7 +174,10 @@ async function build_client({ plugins: [ svelte({ extensions: config.extensions, - emitCss: !config.kit.amp + emitCss: !config.kit.amp, + compilerOptions: { + hydratable: config.kit.ssr + } }) ] }); @@ -462,7 +465,10 @@ async function build_server( }, plugins: [ svelte({ - extensions: config.extensions + extensions: config.extensions, + compilerOptions: { + hydratable: config.kit.ssr + } }) ], // this API is marked as @alpha https://github.com/vitejs/vite/blob/27785f7fcc5b45987b5f0bf308137ddbdd9f79ea/packages/vite/src/node/config.ts#L129 diff --git a/packages/kit/src/core/dev/index.js b/packages/kit/src/core/dev/index.js index 039c040e134b..1b67a1deae91 100644 --- a/packages/kit/src/core/dev/index.js +++ b/packages/kit/src/core/dev/index.js @@ -136,7 +136,10 @@ class Watcher extends EventEmitter { plugins: [ svelte({ extensions: this.config.extensions, - emitCss: !this.config.kit.amp + emitCss: !this.config.kit.amp, + compilerOptions: { + hydratable: this.config.kit.ssr + } }) ], publicDir: this.config.kit.files.assets, From 849e635fea8a57ea0364a73385468c3309d4a8dc Mon Sep 17 00:00:00 2001 From: dominikg Date: Wed, 28 Jul 2021 01:14:10 +0200 Subject: [PATCH 2/2] fix: use config.kit.hydrate instead of config.kit.ssr for compilerOptions.hydratable --- packages/kit/src/core/build/index.js | 4 ++-- packages/kit/src/core/dev/index.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/kit/src/core/build/index.js b/packages/kit/src/core/build/index.js index 26fc7801c541..07d7122ee2e4 100644 --- a/packages/kit/src/core/build/index.js +++ b/packages/kit/src/core/build/index.js @@ -176,7 +176,7 @@ async function build_client({ extensions: config.extensions, emitCss: !config.kit.amp, compilerOptions: { - hydratable: config.kit.ssr + hydratable: !!config.kit.hydrate } }) ] @@ -467,7 +467,7 @@ async function build_server( svelte({ extensions: config.extensions, compilerOptions: { - hydratable: config.kit.ssr + hydratable: !!config.kit.hydrate } }) ], diff --git a/packages/kit/src/core/dev/index.js b/packages/kit/src/core/dev/index.js index 1b67a1deae91..60cbc7377d65 100644 --- a/packages/kit/src/core/dev/index.js +++ b/packages/kit/src/core/dev/index.js @@ -138,7 +138,7 @@ class Watcher extends EventEmitter { extensions: this.config.extensions, emitCss: !this.config.kit.amp, compilerOptions: { - hydratable: this.config.kit.ssr + hydratable: !!this.config.kit.hydrate } }) ],