import type { NextConfig } from "next"; const nextConfig: NextConfig = { // The SDK ships ESM/TS; let Next transpile it. transpilePackages: ["@abe-kap/appshell-sdk"], // The browser calls the Shell BFF same-origin under /shell (so the HttpOnly // session cookie flows). We deliberately use /shell (NOT /api) to avoid // clobbering the existing /api/geo route. Point BFF_ORIGIN at the deployed BFF. async rewrites() { const bff = process.env.BFF_ORIGIN ?? "http://localhost:4000"; return [{ source: "/shell/:path*", destination: `${bff}/api/:path*` }]; }, }; export default nextConfig;