/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  env: {
    NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
  },
  // Ignore build errors for pages that require client-side only rendering
  typescript: {
    ignoreBuildErrors: false,
  },
  eslint: {
    ignoreDuringBuilds: false,
  },
  // Skip static page generation errors for client-only pages
  experimental: {
    missingSuspenseWithCSRBailout: false,
    instrumentationHook: true,
  },
  // Generate error pages instead of failing build on prerender errors
  staticPageGenerationTimeout: 120,
  // Generate build ID with timestamp to avoid cache issues
  generateBuildId: async () => {
    return `build-${Date.now()}`;
  },
  // Disable cache for assets to ensure fresh content
  onDemandEntries: {
    maxInactiveAge: 25 * 1000,
    pagesBufferLength: 2,
  },
};

module.exports = nextConfig;
