vite.config.ts 972 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from "vite";
  2. import react from "@vitejs/plugin-react";
  3. import tailwindcss from "@tailwindcss/vite";
  4. import { resolve } from "node:path";
  5. export default defineConfig({
  6. plugins: [react(), tailwindcss()],
  7. resolve: {
  8. alias: {
  9. "@": resolve(__dirname, "src"),
  10. },
  11. },
  12. server: {
  13. port: 4567,
  14. proxy: {
  15. "/api/v1/events": {
  16. target: `http://localhost:${process.env.INKOS_STUDIO_PORT ?? "4569"}`,
  17. changeOrigin: true,
  18. // SSE needs unbuffered streaming — bypass http-proxy response handling
  19. selfHandleResponse: true,
  20. configure: (proxy) => {
  21. proxy.on("proxyRes", (proxyRes, _req, res) => {
  22. res.writeHead(proxyRes.statusCode ?? 200, proxyRes.headers);
  23. proxyRes.pipe(res);
  24. });
  25. },
  26. },
  27. "/api": {
  28. target: `http://localhost:${process.env.INKOS_STUDIO_PORT ?? "4569"}`,
  29. changeOrigin: true,
  30. },
  31. },
  32. },
  33. });