Replaces hardcoded production API URLs with localhost defaults for local development in both server and client code. Updates Dockerfile to require API URLs via deployment environment variables. Improves ChatTable to use a batch endpoint for chats and unread counts, with backward compatibility. Adds an env.example file to document required environment variables. Updates next.config.mjs to use environment variables for backend API rewrites and image domains.
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
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;
|