feat: Implement offline cache for sw, and autoupdating (#431)

This commit is contained in:
Matt Kilgore
2025-01-04 10:28:01 -05:00
committed by GitHub
parent 2810ff9172
commit 15e0cfb73f

View File

@@ -25,7 +25,21 @@ export default defineNuxtConfig({
pwa: {
workbox: {
navigateFallbackDenylist: [/^\/api/],
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /^\/api/,
handler: "NetworkFirst",
method: "GET",
options: {
cacheName: "api-cache",
cacheableResponse: { statuses: [0, 200] },
expiration: { maxAgeSeconds: 60 * 60 * 24 },
},
},
],
},
registerType: "autoUpdate",
injectRegister: "script",
injectManifest: {
swSrc: "sw.js",