-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
91 lines (90 loc) · 2.25 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
import { defineConfig } from 'vite'
import { VitePWA } from 'vite-plugin-pwa'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
VitePWA({
registerType: 'autoUpdate',
devOptions: {
enabled: true,
},
manifest: {
name: 'SC-VIEWER',
short_name: 'SC-VIEWER',
start_url: '.',
description: 'A frontend for SCTranslationData',
icons: [
{
src: '/icon/プロデューサー.webp',
sizes: '180x180',
type: 'image/webp',
},
],
// share_target: {
// action: '/shared',
// method: 'GET',
// params: {
// title: 'title',
// text: 'text',
// url: 'url',
// },
// },
},
workbox: {
runtimeCaching: [
{
urlPattern: ({ url }) => {
if (
url.hostname === 'event.strawberrytree.top' ||
url.hostname === 'viewer.strawberrytree.top' ||
url.hostname === 'sc-viewer.top' ||
url.hostname === 'www.sc-viewer.top' ||
url.hostname === 'event.sc-viewer.top'
) {
return true
}
return false
},
handler: 'NetworkFirst',
},
{
urlPattern: ({ url }) => {
if (
url.pathname.startsWith('/convert/cache') ||
url.pathname.startsWith('/raw') ||
url.hostname === 'cdn.skypack.dev' ||
url.hostname === 'esm.sh'
) {
return true
}
return false
},
handler: 'StaleWhileRevalidate',
},
{
urlPattern: ({ url }) => {
if (url.pathname.startsWith('/api')) {
return true
}
return false
},
handler: 'NetworkOnly',
},
],
},
}),
],
server: {
host: '0.0.0.0',
},
resolve: {
alias: [
{
find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
},
],
},
})