-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
64 lines (63 loc) · 2.08 KB
/
Copy pathvite.config.ts
File metadata and controls
64 lines (63 loc) · 2.08 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
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import tailwindcss from '@tailwindcss/vite';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
// Treat <iot-*> tags as native custom elements, not Vue components.
isCustomElement: (tag) => tag.startsWith('iot-'),
},
},
}),
tailwindcss(),
// Installable PWA — generates + auto-registers the service worker; the
// manifest stays in public/site.webmanifest, so the plugin only owns the SW.
VitePWA({
registerType: 'autoUpdate',
injectRegister: 'auto',
manifest: false,
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico,woff2}'],
// og.png is for social scrapers; the Code chunk is ~630 kB of CodeMirror
// and esptool-js that needs hardware anyway.
globIgnores: ['**/og.png', '**/CodePanel-*.js'],
navigateFallback: '/index.html',
// Never hijack worker-rendered routes with the SPA fallback.
navigateFallbackDenylist: [/^\/v1/, /^\/ws/, /^\/authorize/, /^\/\.well-known\//],
cleanupOutdatedCaches: true,
},
}),
],
build: {
outDir: 'dist',
emptyOutDir: true,
// Don't ship full source maps to production (smaller deploy, no source
// exposure). Flip to true locally when you need to debug a prod build.
sourcemap: false,
rollupOptions: {
output: {
// Split the stable framework deps into their own long-cached chunks so
// an app-code change doesn't bust them. apexcharts/leaflet are NOT listed
// here on purpose — they're dynamically imported and must stay lazy.
manualChunks: {
vendor: ['vue', 'vue-router', 'pinia'],
ui: ['reka-ui'],
},
},
},
},
server: {
port: 5173,
proxy: {
// During dev, proxy API + WS to the local wrangler dev server.
'/v1': 'http://localhost:8787',
'/ws': {
target: 'ws://localhost:8787',
ws: true,
},
},
},
});