Skip to content

Commit

Permalink
fix: exclude service worker directory from tsconfig
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
[sveltejs#11721](https://github.com/sveltejs/kit/issues/117210)

Follow up to [sveltejs#11727](sveltejs#11727)
  • Loading branch information
gurpreetatwal committed May 7, 2024
1 parent 7a62572 commit 144ff71
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 144ff71

Please sign in to comment.