57 lines
1.7 KiB
TypeScript
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.cocotte.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.lan', '.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,
|
|
},
|
|
});
|