import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import seo from './vite-plugin-seo' // Backend target for the dev proxy. Defaults to the docker-compose service // name; set VITE_PROXY_TARGET=http://localhost:8000 to run the dev server on // the host against a backend reachable at localhost (no CORS, same-origin). const backend = process.env.VITE_PROXY_TARGET || 'http://backend:8000' // Backend target for the *preview* server (the built app). The Playwright // real-backend lane serves `vite preview` and needs same-origin /api, /videos // and /thumbnails to reach a locally-launched uvicorn instead of the compose // service. Defaults to the loopback backend the config's second webServer // starts; CW_BACKEND_URL overrides it for other setups. Proxying keeps the // built bundle origin-relative (no absolute VITE_API_URL baked in). const previewBackend = process.env.CW_BACKEND_URL || 'http://127.0.0.1:8000' // https://vitejs.dev/config/ export default defineConfig({ // seo() runs on build only. It injects the crawler-visible homepage content // into #root and emits the static /alternatives pages, sitemap.xml and // llms.txt. See vite-plugin-seo.js. plugins: [react(), seo()], // The free tools (/youtube-transcript-generator and friends) are static // pages emitted by seo(); their behaviour ships as small standalone entries // with no React in them. vite-plugin-seo.js finds each entry's hashed file // name in the bundle and adds the