import tailwindcss from "@tailwindcss/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [tailwindcss()], // Proxy API requests to the @void-nav/api dev server (apps/api) so the docs // site and its backend share one origin in dev — no CORS, one command to run // both via `pnpm dev:web`. server: { proxy: { "/api": "http://localhost:3001", }, }, esbuild: { jsx: "automatic", jsxImportSource: "react", }, build: { // Generate source maps for production debugging sourcemap: true, // Optimize chunk splitting for better caching rollupOptions: { output: { manualChunks: { // Bundle three.js and related libraries separately "three-vendor": ["three", "@react-three/fiber", "@react-three/drei"], // Bundle React separately (more stable across updates) "react-vendor": ["react", "react-dom", "react-router-dom"], }, }, }, // Chunk size warning limit (in kB) chunkSizeWarningLimit: 1000, }, // Optimize dependency pre-bundling optimizeDeps: { include: ["three", "@react-three/fiber", "@react-three/drei"], }, });