Skip to content

Commit

Permalink
fix: adhere to Vite build.minify setting when building service work…
Browse files Browse the repository at this point in the history
…er (#13143)

closes #11790

This PR passes the user's Vite build.minify config value to the Vite build for the service worker.
  • Loading branch information
eltigerchino authored Dec 12, 2024
1 parent 5d6a8c3 commit a1fea7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-cheetahs-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: adhere to Vite `build.minify` setting when building the service worker
3 changes: 2 additions & 1 deletion packages/kit/src/exports/vite/build/build_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 7 additions & 1 deletion packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a1fea7e

Please sign in to comment.