Skip to content

Commit 2b9ac50

Browse files
committed
chore: store also api calls to cache readme
1 parent abe9cea commit 2b9ac50

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

app/service-worker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ if (import.meta.env.PROD) {
6060
]
6161

6262
registerRoute(
63-
({ sameOrigin, url }) => sameOrigin && url.pathname.startsWith('/package/'),
63+
({ sameOrigin, url }) =>
64+
sameOrigin && (url.pathname.startsWith('/package/') || url.pathname.startsWith('/api/')),
6465
new NetworkFirst({
6566
cacheName: cacheNames[0],
6667
plugins: [
6768
new CacheableResponsePlugin({ statuses: [200] }),
68-
new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 60 }),
69+
new ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 60 }),
6970
],
7071
}),
7172
)
@@ -77,7 +78,7 @@ if (import.meta.env.PROD) {
7778
cacheName: cacheNames[1],
7879
plugins: [
7980
new CacheableResponsePlugin({ statuses: [200] }),
80-
new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 365 * 24 * 60 * 60 }),
81+
new ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 365 * 24 * 60 * 60 }),
8182
],
8283
}),
8384
)

0 commit comments

Comments
 (0)