lilith-platform.live/codebase/@features/vip/frontend-client/vite.config.ts
2026-05-18 01:42:58 -07:00

42 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';
export default defineConfig({
plugins: [react()],
server: {
host: '127.0.0.1',
port: 5178,
allowedHosts: ['vip.quinn.apricot.lan'],
proxy: {
'/www': {
target: 'http://localhost:3030',
changeOrigin: true,
},
'/vip': {
target: 'http://localhost:3030',
changeOrigin: true,
bypass(req) {
// Proxy known prefix-keyed API paths AND token-scoped API paths (/:token/quotes, etc.).
// Everything else falls through to the SPA so /vip/:token/:tab routes render.
const apiPaths = ['/invites', '/relationship', '/messages', '/push', '/referrals', '/billing', '/auth', '/settings'];
const tokenScopedApiPatterns = [/^\/[a-z0-9]+\/quotes(\/|$)/];
const afterVip = (req.url ?? '').replace(/^\/vip/, '');
const matchesApi =
apiPaths.some((p) => afterVip.startsWith(p)) ||
tokenScopedApiPatterns.some((re) => re.test(afterVip));
return matchesApi ? null : req.url;
},
},
},
},
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
},
},
build: {
outDir: 'dist',
sourcemap: false,
},
});