ifixkart-admin/next.config.ts

54 lines
1.3 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
reactCompiler: true,
experimental: {
proxyClientMaxBodySize: "200mb",
optimizePackageImports: ['lucide-react', 'framer-motion', 'date-fns', 'recharts'],
},
turbopack: {
root: process.cwd(),
},
async rewrites() {
const backendUrl = (process.env.NEXT_PUBLIC_API_URL || "https://ifixkartbe.trionixsolution.com")
.replace(/\/api\/v1\/?$/, '')
.replace(/\/+$/, '');
// Media files always served from production (files don't exist on local dev machine)
const mediaUrl = "https://ifixkartbe.trionixsolution.com";
return [
{
source: "/api/v1/:path*",
destination: `${backendUrl}/api/v1/:path*`,
},
{
source: "/uploads/:path*",
destination: `${mediaUrl}/uploads/: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;