-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvite.config.js
More file actions
54 lines (53 loc) · 1.56 KB
/
vite.config.js
File metadata and controls
54 lines (53 loc) · 1.56 KB
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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { VitePWA } from 'vite-plugin-pwa';
import path from 'path';
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['css_sprites.png', 'earth.svg', 'pwa-icon-192.png', 'pwa-icon-512.png'],
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'],
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10MB limit
runtimeCaching: [
{
urlPattern: ({ request }) => request.destination === 'document',
handler: 'NetworkFirst',
options: {
cacheName: 'html-cache',
},
},
{
urlPattern: ({ request }) =>
['style', 'script', 'worker'].includes(request.destination),
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'asset-cache',
},
},
],
},
manifest: {
name: 'Dev.tools',
short_name: 'Dev.tools',
start_url: '/',
display: 'standalone',
background_color: '#2a2a2a',
theme_color: '#2a2a2a',
},
})
],
server: {
host: '0.0.0.0',
port: 3004,
open: true,
https: false,
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
});