import { defineConfig } from 'vite' import { fileURLToPath } from 'node:url' import solid from 'vite-plugin-solid' import tailwindcss from '@tailwindcss/vite' // 构建产物直接落到 Go 的 //go:embed 目录,保持单体仓库发布形态。 // base 设为 /static/ 让 Vite 资源路径命中 Go 的 /static/ 文件服务。 export default defineConfig(({ mode }) => ({ plugins: [solid(), tailwindcss()], // dev 在根路径服务(与 TanStack Router 的路由路径对齐);build 落到 /static/ 供 Go embed base: mode === 'development' ? '/' : '/static/', build: { outDir: fileURLToPath(new URL('../internal/server/static', import.meta.url)), emptyOutDir: true, }, server: { host: "127.0.0.1", port: 3000, // 开发态把控制面 / RTC / 直播流反代到本地 Go 服务(不影响构建产物) proxy: { '/api': 'http://localhost:8088', '/rtc': 'http://localhost:8088', '/live': 'http://localhost:8088', }, }, }))