Fix Service Worker evaluation order of precacheAndRoute
This commit is contained in:
+4
-4
@@ -6,6 +6,10 @@ import { NetworkFirst, NetworkOnly } from 'workbox-strategies'
|
|||||||
|
|
||||||
declare let self: ServiceWorkerGlobalScope
|
declare let self: ServiceWorkerGlobalScope
|
||||||
|
|
||||||
|
precacheAndRoute(self.__WB_MANIFEST)
|
||||||
|
cleanupOutdatedCaches()
|
||||||
|
clientsClaim()
|
||||||
|
|
||||||
const appShellFallback = createHandlerBoundToURL('/index.html')
|
const appShellFallback = createHandlerBoundToURL('/index.html')
|
||||||
const navigationStrategy = new NetworkFirst({
|
const navigationStrategy = new NetworkFirst({
|
||||||
cacheName: 'app-shell',
|
cacheName: 'app-shell',
|
||||||
@@ -20,10 +24,6 @@ registerRoute(({ request }) => request.mode === 'navigate', async (context) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
precacheAndRoute(self.__WB_MANIFEST)
|
|
||||||
cleanupOutdatedCaches()
|
|
||||||
clientsClaim()
|
|
||||||
|
|
||||||
// Always fetch the live deploy version, even under an older precache.
|
// Always fetch the live deploy version, even under an older precache.
|
||||||
registerRoute(({ url }) => url.pathname === '/version.json', new NetworkOnly())
|
registerRoute(({ url }) => url.pathname === '/version.json', new NetworkOnly())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user