Skip to content

Commit 47470f1

Browse files
committed
don't precache all character images
1 parent fa131e2 commit 47470f1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

vite.config.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export default defineConfig({
3030
VitePWA({
3131
registerType: "autoUpdate",
3232
workbox: {
33-
globPatterns: ["**/*.{js,css,html,ico,png,svg}"],
33+
globPatterns: ["**/*.{js,css,html,ico}"],
34+
globIgnores: ["**/images/characters/**"],
3435
runtimeCaching: [
3536
{
3637
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
@@ -43,6 +44,28 @@ export default defineConfig({
4344
},
4445
},
4546
},
47+
{
48+
urlPattern: /\/images\/characters\/.*\.png$/,
49+
handler: "CacheFirst",
50+
options: {
51+
cacheName: "character-images-cache",
52+
expiration: {
53+
maxEntries: 100, // Cache most-used characters
54+
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
55+
},
56+
},
57+
},
58+
{
59+
urlPattern: /\/images\/stages\/.*\.png$/,
60+
handler: "CacheFirst",
61+
options: {
62+
cacheName: "stage-images-cache",
63+
expiration: {
64+
maxEntries: 50, // All stages
65+
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
66+
},
67+
},
68+
},
4669
],
4770
},
4871
includeAssets: ["favicon.ico", "logo192.png", "logo512.png"],

0 commit comments

Comments
 (0)