import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' // 后端运行在 8080,前端开发期通过代理避免跨域 export default defineConfig({ plugins: [react()], base: '/content-similarity-recall/', // CDN 部署路径 server: { port: 5173, host: true, proxy: { '/videoVector': { target: 'https://api-internal.piaoquantv.com', changeOrigin: true, secure: false, configure: (proxy) => { proxy.on('error', (err, req) => { // 把 AggregateError.errors 全部展开, 看每个 IP 的真实失败原因 const inner = (err as any)?.errors // eslint-disable-next-line no-console console.error('[proxy error]', req?.method, req?.url, '\n name:', err?.name, '\n code:', (err as any)?.code, '\n msg:', err?.message, '\n inner:', Array.isArray(inner) ? inner.map((e: any) => `${e?.code}@${e?.address}:${e?.port} ${e?.message}`).join(' | ') : 'none') }) proxy.on('proxyReq', (_pReq, req) => { // eslint-disable-next-line no-console console.log('[proxy req]', req?.method, req?.url) }) }, }, }, }, })