chore: switch web manifest handler to stale while revalidate handler

This commit is contained in:
userquin 2023-11-02 12:47:37 +01:00
parent 059502f3e2
commit 44d0e9c300

View file

@ -3,7 +3,7 @@
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching' import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
import { NavigationRoute, registerRoute } from 'workbox-routing' import { NavigationRoute, registerRoute } from 'workbox-routing'
import { CacheableResponsePlugin } from 'workbox-cacheable-response' import { CacheableResponsePlugin } from 'workbox-cacheable-response'
import { NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies' import { StaleWhileRevalidate } from 'workbox-strategies'
import { ExpirationPlugin } from 'workbox-expiration' import { ExpirationPlugin } from 'workbox-expiration'
import { onNotificationClick, onPush } from './web-push-notifications' import { onNotificationClick, onPush } from './web-push-notifications'
@ -56,7 +56,7 @@ if (import.meta.env.PROD) {
registerRoute( registerRoute(
({ request, sameOrigin, url }) => ({ request, sameOrigin, url }) =>
sameOrigin && request.destination === 'manifest' && url.pathname.startsWith('/manifest-'), sameOrigin && request.destination === 'manifest' && url.pathname.startsWith('/manifest-'),
new NetworkFirst({ new StaleWhileRevalidate({
cacheName: 'elk-webmanifest', cacheName: 'elk-webmanifest',
// responses with a Vary: Accept-Encoding header // responses with a Vary: Accept-Encoding header
matchOptions: { matchOptions: {