import bundleAnalyzer from '@next/bundle-analyzer'; const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env.ANALYZE === 'true' }); /** @type {import('next').NextConfig} */ const baseConfig = { output: 'standalone', reactStrictMode: false, images: { remotePatterns: [ { protocol: "https", hostname: "api.telegram.org", }, { protocol: "https", hostname: "telegram.org", }, // Backend API hostname configured via environment variable ...(process.env.API_HOSTNAME ? [{ protocol: "https", hostname: process.env.API_HOSTNAME, }] : []), ], }, async rewrites() { return [ { source: '/api/:path*', destination: `${process.env.API_BASE_URL || 'http://localhost:3001'}/api/:path*`, }, ]; }, experimental: { // serverExternalPackages has been deprecated in Next.js 15 }, onDemandEntries: { maxInactiveAge: 15 * 1000, pagesBufferLength: 2, }, productionBrowserSourceMaps: false, typescript: { ignoreBuildErrors: true, }, eslint: { ignoreDuringBuilds: true, }, }; const nextConfig = withBundleAnalyzer(baseConfig); export default nextConfig;