-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
vite.config.ts
131 lines (127 loc) · 3.79 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import vue from '@vitejs/plugin-vue'
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
VueI18nPlugin({
include: [path.resolve(__dirname, './locales/**')]
}),
VitePWA({
injectRegister: 'script',
registerType: 'autoUpdate',
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,zip,txt,webp,jar}'],
maximumFileSizeToCacheInBytes: 2e+9, // 2 GB
runtimeCaching: [
// structure icons from mcicons
{
urlPattern: /^https:\/\/raw\.githubusercontent\.com\/jacobsjo\/mcicons\/icons\/item\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: "mcicons-cache",
expiration: {
maxEntries: 3000,
maxAgeSeconds: 60 * 60 * 24 * 90 // 90 days
},
cacheableResponse: {
statuses: [200]
},
fetchOptions: {
}
}
},
// datapacks/mods downloaded from modrinth cdn
{
urlPattern: /^https:\/\/cdn\.modrinth\.com\/data\/.*\.(zip|jar)$/i,
handler: 'CacheFirst',
options: {
cacheName: "modrinth-cdn-cache",
expiration: {
maxEntries: 150,
maxAgeSeconds: 60 * 60 * 24 * 365, // 365 days
purgeOnQuotaError: true
},
cacheableResponse: {
statuses: [200]
}
}
},
// thumbnails downloaded from modrinth cdn
{
urlPattern: /^https:\/\/cdn\.modrinth\.com\/data\/.*\.webp$/i,
handler: 'CacheFirst',
options: {
cacheName: "modrinth-cdn-image-cache",
expiration: {
maxEntries: 3000,
maxAgeSeconds: 60 * 60 * 24 * 365 // 365 days
},
cacheableResponse: {
statuses: [200]
}
}
},
// modrinth api request for projects (not search), used as backup for recents in offline mode
{
urlPattern: /^https:\/\/api\.modrinth\.com\/v2\/project\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: "modrinth-api-cache",
expiration: {
maxEntries: 3000,
maxAgeSeconds: 60 * 60 * 24 * 30 // 30 days
},
cacheableResponse: {
statuses: [200]
}
}
}
],
skipWaiting: true,
clientsClaim: true
},
manifest: {
name: 'Minecraft Datapack Map',
short_name: 'MC Datapack Map',
description: 'A Minecraft biome map capable of handling worldgen datapacks.',
theme_color: '#03213a',
icons: [
{
src: 'favicon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'favicon-512x512.png',
sizes: '512x512',
type: 'image/png'
},
{
src: 'favicon.svg',
sizes: 'any',
type: 'image/svg+xml'
},
{
src: 'favicon-monochrome.svg',
sizes: 'any',
type: 'image/svg+xml',
purpose: 'monochrome'
},
{
src: 'favicon-maskable.svg',
sizes: 'any',
type: 'image/svg+xml',
purpose: 'maskable'
}
]
}
})
],
build: {
sourcemap: true
}
})