[fix] Allow service workers to use the $lib alias
ADD
.changeset/fresh-adults-ring.md
+---
+'@sveltejs/kit': patch
+---
+
+Allow service workers to access files using the $lib alias

MODIFY
packages/kit/src/core/build/index.js
packages/kit/src/core/build/index.js
@@ -606,7 +606,8 @@ async function build_service_worker(
},
resolve: {
alias: {
- '$service-worker': path.resolve(`${build_dir}/runtime/service-worker`)
+ '$service-worker': path.resolve(`${build_dir}/runtime/service-worker`),
+ $lib: config.kit.files.lib
}
}
});

[fix] Allow service workers to use the $lib alias (#2326)