Skip to content

Commit 50d4595

Browse files
committed
move vanilla datapacks to runtime caching
avoiding too large prefetch since there are now quite a few versions.
1 parent ff7d9e0 commit 50d4595

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

vite.config.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,27 @@ export default defineConfig({
1515
injectRegister: 'script',
1616
registerType: 'autoUpdate',
1717
workbox: {
18-
globPatterns: ['**/*.{js,css,html,svg,png,zip,txt,webp,jar}'],
18+
globPatterns: ['**/*.{js,css,html,svg,png,txt,webp}'],
1919
maximumFileSizeToCacheInBytes: 2e+9, // 2 GB
2020
globIgnores: [
2121
'images/px.png'
2222
],
2323
runtimeCaching: [
24+
// vanilla datapacks
25+
{
26+
urlPattern: /^https?:\/\/(map\.jacobsjo\.eu|localhost:4173)\/vanilla_datapacks\/.*\.zip$/i,
27+
handler: 'CacheFirst',
28+
options: {
29+
cacheName: "vanilla-datapack-cache",
30+
expiration: {
31+
maxEntries: 50,
32+
maxAgeSeconds: 60 * 60 * 24 * 90 // 90 days
33+
},
34+
cacheableResponse: {
35+
statuses: [200]
36+
}
37+
}
38+
},
2439
// structure icons from mcicons
2540
{
2641
urlPattern: /^https:\/\/raw\.githubusercontent\.com\/jacobsjo\/mcicons\/icons\/item\/.*/i,

0 commit comments

Comments
 (0)