Cache only index page, not all documents
This commit is contained in:
parent
0cb56870a4
commit
42a3bdca68
@ -7,9 +7,11 @@ import { CacheFirst } from "workbox-strategies";
|
|||||||
|
|
||||||
clientsClaim();
|
clientsClaim();
|
||||||
|
|
||||||
const staticTypes = ["image", "video", "audio", "script", "style", "font", "document"];
|
const staticTypes = ["image", "video", "audio", "script", "style", "font"];
|
||||||
|
const paths = ["/"];
|
||||||
registerRoute(
|
registerRoute(
|
||||||
({ request, url }) => url.origin === self.location.origin && staticTypes.includes(request.destination),
|
({ request, url }) =>
|
||||||
|
url.origin === self.location.origin && (staticTypes.includes(request.destination) || paths.includes(url.pathname)),
|
||||||
new CacheFirst({
|
new CacheFirst({
|
||||||
cacheName: "static-content",
|
cacheName: "static-content",
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user