-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathvite.config.ts
More file actions
148 lines (146 loc) · 4.27 KB
/
vite.config.ts
File metadata and controls
148 lines (146 loc) · 4.27 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
import path from "node:path";
import react from "@vitejs/plugin-react-swc";
import { configDefaults, defineConfig } from "vitest/config";
import { VitePWA } from 'vite-plugin-pwa';
// https://vitejs.dev/config/
export default defineConfig(() => ({
define: {
__BUILD_TIME__: JSON.stringify(new Date().toISOString()),
__BUILD_DATE__: JSON.stringify(new Date().toISOString().split('T')[0]),
},
preview: {
host: "::",
port: 4173,
allowedHosts: ['host.docker.internal', 'localhost', '127.0.0.1'],
},
server: {
host: "::",
port: 8080,
allowedHosts: ['host.docker.internal', 'localhost', '127.0.0.1'],
proxy: {
// Proxy CDN requests to avoid CORS issues in development
'/cdn-proxy': {
target: 'https://cdn.divine.video',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/cdn-proxy/, ''),
secure: true,
configure: (proxy, _options) => {
proxy.on('error', (err, _req, _res) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (_proxyReq, req, _res) => {
console.log('Sending Request to the Target:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req, _res) => {
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
});
},
},
'/api/moderation/check-result': {
target: 'https://moderation-api.divine.video',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/moderation\/check-result/, '/check-result'),
secure: true,
},
},
},
build: {
// Enable source maps for better debugging
sourcemap: false, // Disable in production for smaller builds
// Optimize dependencies
commonjsOptions: {
include: [/node_modules/]
}
},
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
injectRegister: null,
devOptions: {
enabled: false
},
workbox: {
// Disable all caching - network only
skipWaiting: true,
clientsClaim: true,
navigateFallback: null,
runtimeCaching: [],
// Allow larger JS bundles (default 2MB is too small for this app)
maximumFileSizeToCacheInBytes: 3 * 1024 * 1024, // 3MB
},
includeAssets: [
'app_icon.png',
'favicon.png',
'divine-logo.svg',
'og.png',
'no-ai-icon.svg',
'divine_icon_transparent.avif',
'browserconfig.xml'
],
manifest: {
name: 'Divine Web - Short-form Looping Videos',
short_name: 'Divine',
description: 'Watch and share 6-second looping videos on the decentralized Nostr network.',
theme_color: '#27C58B',
background_color: '#09090b',
display: 'standalone',
orientation: 'portrait-primary',
scope: '/',
start_url: '/',
categories: ['entertainment', 'video', 'social'],
screenshots: [
{
src: '/screenshots/iPad 13 inch-0.avif',
sizes: '2048x2732',
type: 'image/avif',
form_factor: 'wide'
},
{
src: '/screenshots/iPad 13 inch-1.avif',
sizes: '2048x2732',
type: 'image/avif',
form_factor: 'wide'
},
{
src: '/screenshots/iPad 13 inch-2.avif',
sizes: '2048x2732',
type: 'image/avif',
form_factor: 'wide'
}
],
icons: [
{
src: 'app_icon.png',
sizes: '1024x1024',
type: 'image/png',
purpose: 'any'
},
{
src: 'app_icon.png',
sizes: '1024x1024',
type: 'image/png',
purpose: 'maskable'
}
]
}
})
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: './src/test/setup.ts',
exclude: [...configDefaults.exclude, '**/.worktrees/**', '**/worktrees/**'],
onConsoleLog(log) {
return !log.includes("React Router Future Flag Warning");
},
env: {
DEBUG_PRINT_LIMIT: '0', // Suppress DOM output that exceeds AI context windows
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
}));