-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Service Worker #1792
Comments
Please provide more details on what you found unintuitive. The reason why this wasn't added yet is because the needs for a service worker setup differ greatly between apps. Sapper did have a default service worker and it caused many people headaches. |
In case of using I didn't know service worker was a problem on sapper and I am not an expert on this field. Maybe you could give some more information about that. As far as I understand I want an always offline first service worker, that caches all static assets. A guide/entry in the docs on how to setup a "default" service worker might be sufficient. What would be the recommended way to implement service workers using https://kit.svelte.dev/docs#modules-service-worker ? |
You can create This is a simple example where I use Workbox's Alternatively, you can use this plugin https://github.com/antfu/vite-plugin-pwa to define everything from svelte config, ie. not write your own service worker code. |
for now You can just copy: https://gist.github.com/Mlocik97/cf0f4c39e46d45404fda8808a25244c8 (based on Sapper's sw) to |
@Mlocik97 Ty for the script. I'll take it for now, until there is an official solution. Works fine though. ;) |
Is your feature request related to a problem? Please describe.
Adding a service worker is not intuitive at the moment.
I found this: https://www.npmjs.com/package/kit-sw-workbox,
but as far as I remember, adding a service worker on
polymer
andgatsby
was pretty clean and simple out of the box.Describe the solution you'd like
I'd like a default service worker automatically generated at build time, if no
src/service-worker.js/ts
exists.The service worker should be disabled in
dev
environment.How important is this feature to you?
I think it is a rather basic feature for static code generators, but not urgent by any means.
Additional context
You already built helpers for implementing a service worker. So, do you already plan this?
https://kit.svelte.dev/docs#modules-service-worker
This
vite plugin
could also be a solution, if it works with svelte-kit.https://github.com/antfu/vite-plugin-pwa
The text was updated successfully, but these errors were encountered: