mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
- manualChunks separates react/wouter, react-query, recharts and lucide from application code: the main bundle drops from 1.73 MB to 1.08 MB and vendor chunks stay browser-cached across deployments since they only change on dependency upgrades - esbuild "pure" removes console.log/console.debug from production builds (console.warn/error kept); the Dockerfile now builds the frontend with NODE_ENV=production so the setting actually applies — this silences the debug-log flood users saw in the browser console in production Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FHdE9nEh8zHhQNGpCgrtYe
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import path from "path";
|
|
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
runtimeErrorOverlay(),
|
|
...(process.env.NODE_ENV !== "production" &&
|
|
process.env.REPL_ID !== undefined
|
|
? [
|
|
await import("@replit/vite-plugin-cartographer").then((m) =>
|
|
m.cartographer(),
|
|
),
|
|
]
|
|
: []),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(import.meta.dirname, "client", "src"),
|
|
"@shared": path.resolve(import.meta.dirname, "shared"),
|
|
},
|
|
},
|
|
// En production, les console.log/debug de debug sont retirés du bundle par
|
|
// le minifieur (console.warn et console.error sont conservés). En dev, tout
|
|
// reste visible.
|
|
esbuild: {
|
|
pure: process.env.NODE_ENV === "production" ? ["console.log", "console.debug"] : [],
|
|
},
|
|
root: path.resolve(import.meta.dirname, "client"),
|
|
build: {
|
|
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
output: {
|
|
// Sépare les grosses dépendances stables du code applicatif :
|
|
// elles ne changent qu'aux montées de version et restent donc en
|
|
// cache navigateur entre deux déploiements, au lieu de faire
|
|
// retélécharger 1,7 Mo à chaque mise en production.
|
|
manualChunks: {
|
|
"vendor-react": ["react", "react-dom", "wouter"],
|
|
"vendor-query": ["@tanstack/react-query"],
|
|
"vendor-charts": ["recharts"],
|
|
"vendor-icons": ["lucide-react"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
fs: {
|
|
strict: true,
|
|
deny: ["**/.*"],
|
|
},
|
|
},
|
|
});
|