mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
perf(build): split vendor chunks and strip debug logs from production bundle
- 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
This commit is contained in:
2 files changed
+21
-1
No files matched your search
+1
-1
@@ -27,7 +27,7 @@ RUN ls -la server/
|
|||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
# Build frontend first
|
# Build frontend first
|
||||||
RUN npx vite build
|
RUN NODE_ENV=production npx vite build
|
||||||
|
|
||||||
# Vérifier que les fichiers sont construits
|
# Vérifier que les fichiers sont construits
|
||||||
RUN echo "=== BUILD VERIFICATION ===" && \
|
RUN echo "=== BUILD VERIFICATION ===" && \
|
||||||
|
|||||||
@@ -22,10 +22,30 @@ export default defineConfig({
|
|||||||
"@shared": path.resolve(import.meta.dirname, "shared"),
|
"@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"),
|
root: path.resolve(import.meta.dirname, "client"),
|
||||||
build: {
|
build: {
|
||||||
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
||||||
emptyOutDir: true,
|
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: {
|
server: {
|
||||||
fs: {
|
fs: {
|
||||||
|
|||||||
Reference in new issue
Block a user