import { readFileSync } from 'node:fs' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf-8')) as { version: string } export default defineConfig({ base: process.env.VITE_BASE_PATH || '/', plugins: [vue()], define: { __APP_VERSION__: JSON.stringify(process.env.VITE_APP_VERSION || pkg.version), }, server: { port: 5173, allowedHosts: true, proxy: { '/api': { target: 'http://localhost:6893', configure(proxy) { proxy.on('proxyRes', (proxyRes, req) => { if (req.url?.includes('/stream')) { proxyRes.headers['cache-control'] = 'no-cache' proxyRes.headers['x-accel-buffering'] = 'no' } }) }, }, }, }, build: { outDir: 'dist', emptyOutDir: true, }, })