forked from pronghorn-red/pronghorn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
209 lines (208 loc) · 6.52 KB
/
vite.config.ts
File metadata and controls
209 lines (208 loc) · 6.52 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import { componentTagger } from "lovable-tagger";
import { VitePWA } from "vite-plugin-pwa";
import viteCompression from "vite-plugin-compression";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
server: {
host: "::",
port: 8080,
},
build: {
rollupOptions: {
output: {
manualChunks: {
// Core React ecosystem
"vendor-react": ["react", "react-dom", "react-router-dom", "@tanstack/react-query"],
// Heavy editor libraries
"vendor-monaco": ["@monaco-editor/react"],
// PDF processing
"vendor-pdf": ["pdfjs-dist"],
// Flow/diagram library
"vendor-reactflow": ["reactflow"],
// Charts library
"vendor-charts": ["recharts"],
// Office document processing
"vendor-office": ["exceljs", "mammoth", "docx", "jszip"],
// Radix UI components
"vendor-radix": [
"@radix-ui/react-accordion",
"@radix-ui/react-alert-dialog",
"@radix-ui/react-avatar",
"@radix-ui/react-checkbox",
"@radix-ui/react-collapsible",
"@radix-ui/react-context-menu",
"@radix-ui/react-dialog",
"@radix-ui/react-dropdown-menu",
"@radix-ui/react-hover-card",
"@radix-ui/react-label",
"@radix-ui/react-menubar",
"@radix-ui/react-navigation-menu",
"@radix-ui/react-popover",
"@radix-ui/react-progress",
"@radix-ui/react-radio-group",
"@radix-ui/react-scroll-area",
"@radix-ui/react-select",
"@radix-ui/react-separator",
"@radix-ui/react-slider",
"@radix-ui/react-slot",
"@radix-ui/react-switch",
"@radix-ui/react-tabs",
"@radix-ui/react-toast",
"@radix-ui/react-toggle",
"@radix-ui/react-toggle-group",
"@radix-ui/react-tooltip",
],
},
},
},
},
plugins: [
react(),
mode === "development" && componentTagger(),
// Brotli compression (best compression ratio)
viteCompression({
algorithm: "brotliCompress",
ext: ".br",
threshold: 1024, // Only compress files > 1KB
}),
// Gzip fallback for older browsers
viteCompression({
algorithm: "gzip",
ext: ".gz",
threshold: 1024,
}),
VitePWA({
registerType: "prompt",
includeAssets: ["favicon.ico", "apple-touch-icon.png", "pwa-192x192.png", "pwa-512x512.png"],
manifest: {
name: "Pronghorn - AI-Powered Enterprise Application Platform",
short_name: "Pronghorn",
description: "Transform unstructured requirements into traceable, compliant applications with Pronghorn's standards-first, agentic AI platform.",
theme_color: "#0a0a0a",
background_color: "#0a0a0a",
display: "standalone",
orientation: "portrait-primary",
start_url: "/",
scope: "/",
id: "/",
categories: ["productivity", "developer tools", "business"],
prefer_related_applications: false,
icons: [
{
src: "/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
{
src: "/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
},
],
},
workbox: {
// Only precache core app files, not large vendor chunks
globPatterns: ["**/*.{css,html,ico,png,svg,woff2}"],
// Exclude vendor chunks from precaching (they'll use runtime caching)
globIgnores: ["**/vendor-*.js"],
maximumFileSizeToCacheInBytes: 2 * 1024 * 1024, // 2 MiB for core app
cleanupOutdatedCaches: true,
clientsClaim: true,
skipWaiting: false,
runtimeCaching: [
// Cache vendor chunks on first use with long expiration
{
urlPattern: /\/assets\/vendor-.*\.js$/,
handler: "CacheFirst",
options: {
cacheName: "vendor-chunks",
expiration: {
maxEntries: 20,
maxAgeSeconds: 60 * 60 * 24 * 30, // 30 days
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
// Cache lazy-loaded page chunks
{
urlPattern: /\/assets\/.*-[a-zA-Z0-9]+\.js$/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "page-chunks",
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 days
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
{
urlPattern: /^https:\/\/.*\.supabase\.co\/.*/i,
handler: "NetworkFirst",
options: {
cacheName: "supabase-api",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 60, // 1 hour
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "gstatic-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // 1 year
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
],
},
devOptions: {
enabled: false,
},
}),
].filter(Boolean),
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
}));