-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
44 lines (42 loc) · 1.95 KB
/
Copy pathvite.config.ts
File metadata and controls
44 lines (42 loc) · 1.95 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
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import {defineConfig} from 'vite';
export default defineConfig(({command}) => {
return {
// Production builds are served by the theDAW backend under the `/vj-app/`
// subpath (FastAPI StaticFiles mount), so assets must resolve relative to
// that prefix. The dev server keeps base '/' so the standalone
// `npm run dev` / theDAW_VJ_DEV spawn is unchanged.
base: command === 'build' ? '/vj-app/' : '/',
plugins: [react(), tailwindcss()],
optimizeDeps: {
// transformers.js (the monocular-depth "depthcloud" source) loads
// onnxruntime-web wasm/webgpu workers via import.meta.url relative to its
// own dist. Vite's dep pre-bundling rewrites those URLs and breaks the
// worker/wasm resolution; excluding it keeps them correct. It is only
// imported inside the depth Web Worker, so it stays out of the main bundle.
exclude: ['@huggingface/transformers'],
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
},
},
server: {
// Bind to all interfaces (0.0.0.0) so a phone/tablet on the same
// LAN can reach the VJ output via the host machine's LAN IP. The
// SA3 backend (/api/vj/url) advertises that LAN URL for QR/mobile.
host: true,
// Don't reject requests whose Host header is a LAN IP or hostname.
// Vite blocks unknown hosts by default for DNS-rebind protection;
// `true` disables that check so mobile devices aren't blocked.
allowedHosts: true as const,
// HMR is disabled in AI Studio via DISABLE_HMR env var.
// Do not modifyâfile watching is disabled to prevent flickering during agent edits.
hmr: process.env.DISABLE_HMR !== 'true',
// Disable file watching when DISABLE_HMR is true to save CPU during agent edits.
watch: process.env.DISABLE_HMR === 'true' ? null : {},
},
};
});