-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathvite.config.ts
More file actions
77 lines (76 loc) · 2 KB
/
vite.config.ts
File metadata and controls
77 lines (76 loc) · 2 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { defineConfig } from 'vite'
import { resolve } from 'path'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'injectManifest',
srcDir: 'src',
filename: 'sw.ts',
includeAssets: ['favicon.ico', 'logo.png', 'favicon-16x16.png', 'favicon-32x32.png'],
manifest: {
name: 'MeshMonitor',
short_name: 'MeshMonitor',
description: 'Meshtastic Node Monitoring',
theme_color: '#1a1a1a',
background_color: '#1a1a1a',
display: 'standalone',
scope: '/',
start_url: '/',
orientation: 'any',
icons: [
{
src: 'logo.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any maskable'
}
]
},
injectManifest: {
globPatterns: ['**/*.{js,css,ico,png,svg}'],
// Exclude HTML and API routes from precaching
// HTML must be fetched from server to get runtime BASE_URL path rewriting
globIgnores: ['**/api/**', '**/*.html'],
// Increase size limit to accommodate large bundle (maplibre-gl, recharts, etc.)
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024 // 4 MB
},
devOptions: {
enabled: true,
type: 'module'
}
})
],
// Always build for root - runtime HTML rewriting will handle BASE_URL
base: '/',
server: {
host: true,
port: 5173,
strictPort: true,
allowedHosts: ['sentry.yeraze.online'],
proxy: {
'/api': {
target: 'http://localhost:3001',
changeOrigin: true,
}
}
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
embed: resolve(__dirname, 'embed.html'),
},
external: [
'./src/services/database.js',
'better-sqlite3',
'path',
'url',
'fs'
]
}
}
})