/** @type {import('next').NextConfig} */
const isProd = process.env.NODE_ENV === "production";

const apiBaseUrl =
  process.env.NEXT_PUBLIC_API_BASE_URL ;

const nextConfig = {
  reactStrictMode: false,
  basePath: isProd ? process.env.NEXT_PUBLIC_BASE_PATH : "",

  async rewrites() {
    if (isProd) return [];
    return [
      {
        source: "/api-proxy/:path*",
        destination: `${apiBaseUrl}/:path*`,
      },
    ];
  },

  images: {
    unoptimized: true,
  },

  eslint: {
    ignoreDuringBuilds: true,
  },
  env: {
    NEXT_PUBLIC_API_BASE_URL: process.env.NEXT_PUBLIC_API_BASE_URL,
    NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL,
  },
};

module.exports = nextConfig;
