/** * FastAPI-Vue Vite Plugin * auto-upgrade@fastapi-vue-setup -- remove this if you edit the plugin * * Configures Vite for FastAPI backend integration: * - Proxies /api/* requests to the FastAPI backend * - Builds to the Python module's frontend-build directory * - Disables Vite's screen clearing on startup * * Options: * paths - Array of paths to proxy (default: ['/api']) */ export default function fastapiVue({ paths = ['/api'] } = {}) { const backendUrl = process.env.MEDIAHIVE_BACKEND_URL || 'http://localhost:8421' // Build proxy configuration for each path const proxy = {} for (const path of paths) { proxy[path] = { target: backendUrl, changeOrigin: false, ws: true, } } return { name: 'vite-plugin-fastapi-mediahive', config: () => ({ clearScreen: false, server: { proxy }, build: { outDir: '../mediahive/frontend-build', emptyOutDir: true, }, }), } }