clipwright/dashboard/vite.config.js
pedro-bento 91a5465f81
All checks were successful
CI / unit (push) Successful in 45s
CI / backend-e2e (push) Successful in 1m16s
CI / dashboard-e2e (push) Successful in 2m29s
chore: drop watermark feature, CLI, docs, design.md; consolidate requirements (#6)
- Remove the watermark feature end to end (watermarked.py, apply_watermark/
  mark_delivery/watermark_filter, WATERMARK env, assets/) and its tests; self-host
  delivery is now unconditionally clean.
- Delete the unused cli/ package and .github/workflows/publish-cli.yml.
- Delete docs/ (compliance) and design.md; drop the dangling references in the
  legal page and the design-token/ui comments.
- Consolidate requirements: requirements.txt (runtime) + requirements-test.txt
  (unit + E2E); remove requirements-e2e.txt and requirements-ml-e2e.txt and
  point both CI jobs at the single test file. Add libgl1 to the unit job
  (scenedetect -> opencv-python links libGL).

Verified in the CI container: unit 701 passed; API E2E 209; pipeline E2E 127;
Playwright 19 passed / 1 skipped.

Reviewed-on: #6
Co-authored-by: pedro-bento <mail@pbento.pt>
Co-committed-by: pedro-bento <mail@pbento.pt>
2026-10-05 11:11:37 +01:00

57 lines
2.3 KiB
JavaScript

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 <script> to its page.
build: {
rollupOptions: {
input: {
main: 'index.html',
'tool-transcript': 'tools/transcript.js',
'tool-metadata': 'tools/metadata.js',
'tool-vertical': 'tools/vertical.js',
},
},
},
server: {
allowedHosts: [
'git.pbento.pt',
],
proxy: {
'/api': { target: backend, changeOrigin: true },
'/videos': { target: backend, changeOrigin: true },
'/thumbnails': { target: backend, changeOrigin: true },
}
},
// Mirror of server.proxy for `vite preview`, so the production bundle talks
// to the real backend same-origin (the browser E2E real-backend lane).
preview: {
proxy: {
'/api': { target: previewBackend, changeOrigin: true },
'/videos': { target: previewBackend, changeOrigin: true },
'/thumbnails': { target: previewBackend, changeOrigin: true },
}
}
})