import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ output: "standalone", async redirects() { if (!process.env.BACKEND_PORT) { throw new Error( "Environment variable BACKEND_PORT is not defined.", ); } return [ { source: "/api", destination: `http://localhost:${process.env.BACKEND_PORT}`, permanent: false, }, ]; }, }; export default nextConfig;