Files
VibeFinance/frontend/vite.config.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-04-16 10:22:13 +02:00
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { readFileSync } from "fs";
import { fileURLToPath } from "url";
import { dirname, join } from "path";
const __dirname = dirname(fileURLToPath(import.meta.url));
const pkg = JSON.parse(readFileSync(join(__dirname, "package.json"), "utf-8"));
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
// In dev: proxy /api naar de backend zodat je geen CORS-issues hebt
proxy: {
"/api": {
target: "http://backend:3001",
changeOrigin: true,
secure: false,
},
},
},
build: {
outDir: "dist",
sourcemap: false, // zet op true voor staged deploys
chunkSizeWarningLimit: 800,
rollupOptions: {
output: {
// Splits vendor chunks voor betere caching
manualChunks: {
react: ["react", "react-dom"],
},
},
},
},
define: {
// VITE_API_URL wordt ingebakken tijdens build
__API_URL__: JSON.stringify(process.env.VITE_API_URL ?? "/api"),
__APP_VERSION__: JSON.stringify(process.env.VITE_APP_VERSION ?? pkg.version),
},
});