lilith-platform.live/codebase/@features/user-data/dashboard-network/vite.config.ts
autocommit 39411ae08a chore(user-data): 🔧 Update Vite config for optimized network builds in user data dashboard
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-15 22:00:01 -07:00

57 lines
1.7 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
/**
* Dev: vite proxies /api/network/* to the @analytics query API on apricot:3003.
* Prod: nginx at data.cocotted.maison does the same proxy. Either way, the
* SPA only hits same-origin /api/network/*.
*
* Rollup panels (acquisition, audience, etc.) hit un-scoped firehose endpoints
* that the @analytics API exposes at /acquisition/* and /audience/*. We forward
* /api/acquisition and /api/audience without rewriting the prefix because the
* upstream paths match after stripping the leading /api.
*/
export default defineConfig({
plugins: [react()],
server: {
port: 5130,
host: '::',
allowedHosts: ['apricot.local', '.apricot.lan', 'localhost'],
proxy: {
'/api/network': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api\/network/, '/network'),
},
'/api/acquisition': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},
'/api/audience': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},
'/api/engagement': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},
'/api/trends': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},
'/api/sessions': {
target: 'http://localhost:3003',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api/, ''),
},
},
},
build: {
outDir: 'dist',
sourcemap: true,
},
});