34 lines
920 B
TypeScript
34 lines
920 B
TypeScript
|
|
import { fileURLToPath, URL } from 'node:url'
|
||
|
|
import { defineConfig } from 'vite'
|
||
|
|
import vue from '@vitejs/plugin-vue'
|
||
|
|
|
||
|
|
// https://vite.dev/config/
|
||
|
|
//
|
||
|
|
// Dev server runs on :5173. `/api` is proxied to the FastAPI backend on :8000
|
||
|
|
// so the SPA can call relative `/api/...` URLs in both dev (proxy) and prod
|
||
|
|
// (reverse proxy). `/api/media/` streams media; it is matched first and left
|
||
|
|
// un-rewritten so the backend receives the raw path.
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [vue()],
|
||
|
|
resolve: {
|
||
|
|
alias: {
|
||
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||
|
|
},
|
||
|
|
},
|
||
|
|
server: {
|
||
|
|
port: 5173,
|
||
|
|
strictPort: true,
|
||
|
|
proxy: {
|
||
|
|
// Streaming media first — no path rewrite, ws off.
|
||
|
|
'/api/media': {
|
||
|
|
target: 'http://localhost:8000',
|
||
|
|
changeOrigin: true,
|
||
|
|
},
|
||
|
|
'/api': {
|
||
|
|
target: 'http://localhost:8000',
|
||
|
|
changeOrigin: true,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})
|