import type { NextConfig } from "next"; const nextConfig: NextConfig = { // The SDKs ship ESM/TS source (their `exports` point at src/), so Next must // transpile them rather than treat them as prebuilt CJS. transpilePackages: ["@abe-kap/appshell-sdk", "@insignia/iios-messaging-ui", "@photo-gallery/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;