import type { NextConfig } from "next";
/**
* The browser talks to /api/* on the Next origin; this rewrite proxies it to
* jac-serve. Server components read JAC_SERVE_URL directly (lib/api.ts).
*/
const nextConfig: NextConfig = {
// Traces the server and its dependencies into `.next/standalone`, which is
// the whole build context the runtime image needs — no node_modules, no
// source. Required for the container; harmless locally.
output: "standalone",
async rewrites() {
const target = process.env.JAC_SERVE_URL ?? "http://localhost:8787";
return [{ source: "/api/:path*", destination: `${target}/api/:path*` }];
},
};
export default nextConfig;