live-sfu-demo/web/vite.config.ts

26 lines
973 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: {
port: 5173,
// 开发态把控制面 / RTC / 直播流反代到本地 Go 服务(不影响构建产物)
proxy: {
'/api': 'http://localhost:8088',
'/rtc': 'http://localhost:8088',
'/live': 'http://localhost:8088',
},
},
}))