forked from pwa-builder/pwa-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
43 lines (42 loc) · 987 Bytes
/
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
import { defineConfig } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/
export default defineConfig({
base: "/",
build: {
sourcemap: true,
assetsDir: "code",
},
plugins: [
VitePWA({
registerType: "autoUpdate",
injectRegister: false,
manifest: false,
workbox: {
globDirectory: 'dist',
globPatterns: [
'**/*.{html,js,css,png,webp,jpg}'
],
runtimeCaching: [
{
urlPattern: /^https:\/\/unpkg\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'unpkg-libs-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
}
]
},
devOptions: {
enabled: true
}
})
]
})