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

import os from "os";
const isWindows = os.platform() === "win32";

const nextConfig = {
    experimental: {
        serverComponentsExternalPackages: ["typeorm", "knex"],
    },
    reactStrictMode: true,
    // For port transfer
    async rewrites() {
        return [
            {
                source: '/api/:path*',
                destination: isWindows
                    ? "http://localhost:8080/api/:path*"       // For Windows
                    : "http://localhost:8080/api/:path*",  // For Linux/Mac/Server
            },
        ];
    },
};

export default nextConfig;
