/** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, // Enable compression compress: true, // Optimize package imports (tree-shake large libraries) experimental: { optimizePackageImports: ['lucide-react', 'recharts'], // Enable instrumentation.ts hook (boots EVE auto-sync cron at startup). // This is on by default in Next 15+, but Next 14 needs the opt-in flag. instrumentationHook: true, // node-cron is a Node-only module — keep it server-side, never bundled serverComponentsExternalPackages: ['node-cron'], }, // Image optimization images: { formats: ['image/avif', 'image/webp'], }, // Cache headers for static assets and API routes async headers() { return [ { source: '/_next/static/:path*', headers: [ { key: 'Cache-Control', value: 'public, max-age=31536000, immutable' }, ], }, { source: '/api/currencies', headers: [ { key: 'Cache-Control', value: 'private, max-age=3600, stale-while-revalidate=7200' }, ], }, { source: '/api/fiscal-periods', headers: [ { key: 'Cache-Control', value: 'private, max-age=3600, stale-while-revalidate=7200' }, ], }, { source: '/api/accounts', headers: [ { key: 'Cache-Control', value: 'private, max-age=300, stale-while-revalidate=600' }, ], }, ]; }, }; module.exports = nextConfig;