Skip to content

Commit

Permalink
fix: build service workers in IIFE format (#11129)
Browse files Browse the repository at this point in the history
  • Loading branch information
meticoeus committed Dec 18, 2023
1 parent 83caeef commit 5f052a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-meals-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: build service workers in IIFE format
3 changes: 3 additions & 0 deletions packages/kit/src/exports/vite/build/build_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export async function build_service_worker(
'service-worker': service_worker_entry_file
},
output: {
// default 'es' format would be nicer
// iife is workaround for https://github.com/vitejs/vite/issues/15379
format: 'iife',
entryFileNames: '[name].js',
assetFileNames: `${kit.appDir}/immutable/assets/[name].[hash][extname]`,
inlineDynamicImports: true
Expand Down

0 comments on commit 5f052a3

Please sign in to comment.