a68292c7e9
Allows serving the UI under a subpath (e.g. /ui) instead of root.
- Vite config reads BASE_PATH env var, sets it as the asset base
and injects __BASE_PATH__ for runtime use
- React Router uses basename from __BASE_PATH__ for client-side routing
- Nginx config uses ${BASE_PATH} placeholder, replaced at build time
- Dockerfile accepts BASE_PATH build arg (default: /)
- Woodpecker docker pipeline passes BASE_PATH=/ui
21 lines
461 B
TypeScript
21 lines
461 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
const basePath = process.env.BASE_PATH || '/'
|
|
|
|
export default defineConfig({
|
|
base: basePath,
|
|
plugins: [react()],
|
|
server: {
|
|
proxy: {
|
|
'/api': 'http://localhost:8000',
|
|
'/v2': 'http://localhost:8000',
|
|
'/health': 'http://localhost:8000',
|
|
'/metrics': 'http://localhost:8000',
|
|
},
|
|
},
|
|
define: {
|
|
'__BASE_PATH__': JSON.stringify(basePath),
|
|
},
|
|
})
|