/**
 * @type {import('next').NextConfig}
 */

const output = process.env.NODE_ENV === 'production' ? 'export' : 'standalone';
const backendProxyTarget = process.env.BACKEND_INTERNAL_URL || 'http://127.0.0.1:3000';

 const nextConfig = {
trailingSlash: true,
  async rewrites() {
    if (process.env.NODE_ENV === 'production') {
      return [];
    }

    return [
      {
        source: '/api/:path*',
        destination: `${backendProxyTarget}/api/:path*`,
      },
    ];
  },
  distDir: 'build',
  output,
  basePath: "",
  devIndicators: {
     position: 'bottom-left',
  },
  typescript: {
     ignoreBuildErrors: true,
  },
  eslint: {
     ignoreDuringBuilds: true,
  },
  images: {
    unoptimized: true,
    remotePatterns: [
      {
        protocol: 'https',
        hostname: '**',
      },
    ],
  },
 
}

export default nextConfig