Skip to content

Commit

Permalink
FIX Error in browser console, when loading the service-worker.js for …
Browse files Browse the repository at this point in the history
…svelte

In Svelte and SvelteKit there is no index.html due to the routing. So / is the entrypoint to the app. I think that this should be reflected in the createHandlerBoundRoute() function. So I changed it to / and the uncaugth Error from the browsers console does no longer show up. Precaching works correct and the registration of the sevice woker is now possible without moving to state "redundant" any more.
I think that it was just a typo, because in the .ts files of template-custom-svelte-kit it was already set to "/".
  • Loading branch information
alexander-vidoni committed Oct 18, 2024
1 parent 84f8e63 commit 6454eab
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion templates/template-custom-svelte-kit/src/claims-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))

Expand Down
2 changes: 1 addition & 1 deletion templates/template-custom-svelte-kit/src/prompt-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))
2 changes: 1 addition & 1 deletion templates/template-svelte-ts/src/claims-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))

Expand Down
2 changes: 1 addition & 1 deletion templates/template-svelte-ts/src/prompt-sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))
2 changes: 1 addition & 1 deletion templates/template-svelte/src/claims-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))

Expand Down
2 changes: 1 addition & 1 deletion templates/template-svelte/src/prompt-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ if (import.meta.env.DEV)

// to allow work offline
registerRoute(new NavigationRoute(
createHandlerBoundToURL('index.html'),
createHandlerBoundToURL('/'),
{ allowlist },
))

0 comments on commit 6454eab

Please sign in to comment.