import type { NextConfig } from "next"; const nextConfig: NextConfig = { experimental: { optimizePackageImports: ['lucide-react', 'framer-motion', 'date-fns', 'recharts'], }, async rewrites() { const backendUrl = (process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8000") .replace(/\/api\/v1\/?$/, '') .replace(/\/+$/, ''); const mediaUrl = "https://ifixkartbe.trionixsolution.com"; return [ { source: "/api/v1/:path*", destination: `${backendUrl}/api/v1/:path*`, }, { source: "/uploads/:path*", destination: `${mediaUrl}/uploads/:path*`, }, { source: "/openwa/:path*", destination: "http://127.0.0.1:8088/:path*", }, ]; }, images: { remotePatterns: [ { protocol: 'http', hostname: 'localhost', port: '8000', pathname: '/uploads/**', }, { protocol: 'http', hostname: '127.0.0.1', port: '8000', pathname: '/uploads/**', }, { protocol: 'https', hostname: 'ifixkartbe.trionixsolution.com', pathname: '/uploads/**', }, ], }, }; export default nextConfig;