-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
51 lines (48 loc) · 1.13 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
import { defineConfig } from 'vite';
import { VitePWA, ManifestOptions } from 'vite-plugin-pwa';
import vue from '@vitejs/plugin-vue';
let icons: Record<string, any>[] = [
{
src: '/public/icon.png',
size: '192x192',
type: 'image/png',
},
];
let manifest: Partial<ManifestOptions> = {
name: '计算器',
short_name: '计算器',
start_url: '/',
description: 'A simple demo.',
// background_color: '#F1FAFA',
// theme_color: '#00B271',
display: 'standalone',
icons: icons,
};
export default defineConfig({
plugins: [
vue(),
VitePWA({
includeAssets: ['favicon.ico'],
manifest: manifest,
registerType: 'autoUpdate',
workbox: {
runtimeCaching: [
{
urlPattern: /(.*?)\.(js|css|ts)/,
handler: 'CacheFirst',
options: {
cacheName: 'js-css-cache',
},
},
{
urlPattern: /(.*?)\.(png|jpe?g|svg|gif|bmp|psd|tiff|tga|eps)/,
handler: 'CacheFirst',
options: {
cacheName: 'image-cache',
},
},
],
},
}),
],
});