Skip to content

Commit

Permalink
fix: exclude service worker directory from tsconfig (#12196)
Browse files Browse the repository at this point in the history
The [docs](https://kit.svelte.dev/docs/service-workers) state that the
service worker can be located at `src/service-worker.js` or as an
`index.js` file within the `src/service-worker` directory.

Without this fix users who place the file within the directory run into
Typescript errors like
[#11721](https://github.com/sveltejs/kit/issues/117210)

Follow up to [#11727](#11727)
  • Loading branch information
gurpreetatwal authored Aug 29, 2024
1 parent 45cb8c5 commit 108cb12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-ladybugs-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: exclude service worker directory from tsconfig
3 changes: 3 additions & 0 deletions packages/kit/src/core/sync/write_tsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ export function get_tsconfig(kit) {
exclude.push(config_relative(kit.files.serviceWorker));
} else {
exclude.push(config_relative(`${kit.files.serviceWorker}.js`));
exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.js`));
exclude.push(config_relative(`${kit.files.serviceWorker}.ts`));
exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.ts`));
exclude.push(config_relative(`${kit.files.serviceWorker}.d.ts`));
exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.d.ts`));
}

const config = {
Expand Down

0 comments on commit 108cb12

Please sign in to comment.