/** @type {import('next').NextConfig} */ const nextConfig = { // EN: Enable React strict mode for development warnings // VI: Bật React strict mode để hiển thị warnings trong development reactStrictMode: true, // EN: Output standalone build for container deployment // VI: Output build standalone để deploy trong container output: 'standalone', // EN: Image optimization configuration // VI: Cấu hình tối ưu hình ảnh images: { // EN: Enable image optimization with WebP/AVIF formats // VI: Bật tối ưu hình ảnh với định dạng WebP/AVIF formats: ['image/avif', 'image/webp'], // EN: Remote image domains (if needed) // VI: Các domain hình ảnh từ xa (nếu cần) remotePatterns: [ { protocol: 'https', hostname: '**', }, ], // EN: Device sizes for responsive images // VI: Kích thước thiết bị cho hình ảnh responsive deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], // EN: Image sizes for different breakpoints // VI: Kích thước hình ảnh cho các breakpoint khác nhau imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], }, // EN: Environment variables exposed to the browser // VI: Biến môi trường được expose cho browser env: { // EN: Public API URL for client-side API calls // VI: URL API public để gọi API từ client-side NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost/api/v1', }, // EN: Headers for caching static assets (1 year) - Performance optimization // VI: Headers cho caching static assets (1 năm) - Tối ưu hiệu suất async headers() { return [ { source: '/_next/static/:path*', headers: [ { key: 'Cache-Control', value: 'public, max-age=31536000, immutable', }, ], }, { source: '/images/:path*', headers: [ { key: 'Cache-Control', value: 'public, max-age=31536000, immutable', }, ], }, ]; }, // EN: Compress responses - Performance optimization // VI: Nén responses - Tối ưu hiệu suất compress: true, // EN: Ignore ESLint errors during build (linting should be done separately) // VI: Bỏ qua lỗi ESLint trong build (linting nên được chạy riêng) eslint: { ignoreDuringBuilds: true, }, // EN: Remove console.log in production // VI: Xóa console.log trong production ...(process.env.NODE_ENV === 'production' && { compiler: { removeConsole: { exclude: ['error', 'warn'], }, }, }), }; module.exports = nextConfig;