import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import tailwindcss from "@tailwindcss/vite"; const target = process.env.OTEL_URL ?? "https://otel.k6n.net"; // Device-grant issuer for local/agent development (see src/dev/device-auth.ts). // Proxied same-origin so the browser needs no CORS and no issuer URL. const authIssuer = process.env.AUTH_DEV_BASE ?? "https://users.k6n.net"; // https://vite.dev/config/ export default defineConfig({ plugins: [react(), tailwindcss()], build: { // Upload these maps to the receiver during deployment; do not publish // them with the static UI. sourcemap: true, }, server: { proxy: { "/api": { target: target, changeOrigin: true, }, // RUM script and its ingest endpoint. Without these Vite answers // /static/otel-rum.js with index.html, OtelRUM never loads and main.tsx // silently skips init. "/static": { target: target, changeOrigin: true, }, "/v1/logs": { target: target, changeOrigin: true, }, "/dev-auth": { target: authIssuer, changeOrigin: true, rewrite: (path) => path.replace(/^\/dev-auth/, "/api/auth"), }, "/auth_callback": { target: target, changeOrigin: true, }, "/ws": { target: target, ws: true, }, }, }, });