diff --git a/.changeset/rotten-cheetahs-complain.md b/.changeset/rotten-cheetahs-complain.md new file mode 100644 index 000000000000..1650a70be1a4 --- /dev/null +++ b/.changeset/rotten-cheetahs-complain.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: adhere to Vite `build.minify` setting when building the service worker diff --git a/packages/kit/src/exports/vite/build/build_service_worker.js b/packages/kit/src/exports/vite/build/build_service_worker.js index a7c11188d02a..3b7c1cfe38f9 100644 --- a/packages/kit/src/exports/vite/build/build_service_worker.js +++ b/packages/kit/src/exports/vite/build/build_service_worker.js @@ -105,7 +105,8 @@ export async function build_service_worker( } }, outDir: `${out}/client`, - emptyOutDir: false + emptyOutDir: false, + minify: vite_config.build.minify }, configFile: false, define: vite_config.define, diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js index e6521e979560..2c76a71f0026 100644 --- a/packages/kit/src/exports/vite/index.js +++ b/packages/kit/src/exports/vite/index.js @@ -886,7 +886,13 @@ async function kit({ svelte_config }) { await build_service_worker( out, kit, - vite_config, + { + ...vite_config, + build: { + ...vite_config.build, + minify: initial_config.build?.minify ?? 'esbuild' + } + }, manifest_data, service_worker_entry_file, prerendered,