perf: docker + next.js build optimisation - dockerignore exclusions, BuildKit cache mounts, backend image reuse, memory limits, next.js bundle tree-shaking
This commit is contained in:
@@ -11,6 +11,34 @@ const API_BASE =
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
|
||||
// ── Performance: strip X-Powered-By header ──────────────────────────────
|
||||
poweredByHeader: false,
|
||||
|
||||
// ── Performance: gzip compression handled by Next.js standalone server ──
|
||||
compress: true,
|
||||
|
||||
// ── Compiler optimisations ───────────────────────────────────────────────
|
||||
compiler: {
|
||||
// Remove console.log statements from production builds
|
||||
removeConsole: process.env.NODE_ENV === "production"
|
||||
? { exclude: ["error", "warn"] }
|
||||
: false,
|
||||
},
|
||||
|
||||
// ── Tree-shake large packages (only import what is used) ─────────────────
|
||||
// This tells Next.js to side-effect-free import specific packages,
|
||||
// significantly reducing the bundle size for heavy libraries.
|
||||
experimental: {
|
||||
optimizePackageImports: [
|
||||
"lucide-react",
|
||||
"recharts",
|
||||
"framer-motion",
|
||||
"date-fns",
|
||||
],
|
||||
},
|
||||
|
||||
// ── API proxy rewrites ───────────────────────────────────────────────────
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user