-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example project renders home page on missing routes #45
Comments
I assume you're talking about dev server: we configure the entry point to avoid caching any resource, you're in dev mode and so the sw will intercept any request, any change made to the UI will not be updated. |
Hey, thanks for the quick response! I noticed that this is meant for
Maybe it makes sense to run the following code only in + if (import.meta.env.DEV) {
// to prevent service worker from intercepting requests in dev mode
registerRoute(new NavigationRoute(
createHandlerBoundToURL('/'),
{ allowlist },
))
+ } |
@kelvindecosta then your app will not work when offline EDIT: I mean, your service worker will work in both envs, |
Thanks for the information! To be completely clear, the app seems to work when in offline mode, after the above change.
The app seems to be working fine.
Even the By strictly following the example project code, the |
I'm having the same issue using |
Overview
When navigating to missing routes (
404
) within the example project, the home page (/
) is rendered instead.I've adopted almost the same configuration and service worker script for a personal project.
I've noticed that the service worker even redirects server routes (
+server.ts
) to/
.Cause
I think that the issue lies within the following lines within the service worker script:
sveltekit/examples/sveltekit-ts/src/prompt-sw.ts
Lines 21 to 29 in c6c3499
When getting rid of these lines from my personal project, I no longer run into this issue.
404
error page+server.ts
routes behave as expectedConclusion
I would appreciate it if some more context could be added as to why these lines are required.
Thank you for your time.
The text was updated successfully, but these errors were encountered: