Skip to content
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

How do I add support for plugins ? Specially statusPlugin #736

Open
Kuro091 opened this issue Aug 5, 2024 · 1 comment
Open

How do I add support for plugins ? Specially statusPlugin #736

Kuro091 opened this issue Aug 5, 2024 · 1 comment

Comments

@Kuro091
Copy link

Kuro091 commented Aug 5, 2024

https://developer.chrome.com/docs/workbox/using-plugins

Question is how do I translate this piece of code:
GoogleChrome/workbox#2599 (comment)

into vite pwa config without having to assign a custom base service-worker

which involves having a statusPlugin inside NetworkOnly constructor ?

@userquin
Copy link
Member

userquin commented Aug 12, 2024

Check vite-pwa/sveltekit#65 (comment)

For background sync you can use backgroundSync entry, something like this (not tested):

             runtimeCaching: [{
                urlPattern: /\/api\/.*\/*.json/,
                handler: 'NetworkFirst', // <== or NetworkOnly: if so update the options properly
                method: 'POST',
                options: {
                    cacheName: 'api-cache',
                    expiration: {
                      maxEntries: 5,
                      maxAgeSeconds: 60,
                    },
                    backgroundSync: {
                      name: 'api-queue',
                      options: {
                          maxRetentionTime: 60 * 60,
                      },
                    },
                },
            }]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants