From ce6b839091dc8fc13587e8901ae36c329fdf8245 Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Fri, 20 Mar 2026 02:47:34 -0700 Subject: [PATCH 1/4] chore: conditionalize MFE config behind DEMO env var MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes basePath and assetPrefix conditional on DEMO env var so a single branch can serve both the forkable template (no base path) and the demo deployment (mounted at /demo subpath). Removes the hardcoded redirect from vercel.json — the demo project should configure this in Vercel project settings instead. --- next.config.ts | 5 ++--- vercel.json | 9 +-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/next.config.ts b/next.config.ts index 32eeb60ef1..0833124126 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,11 +1,10 @@ import { withBotId } from "botid/next/config"; import type { NextConfig } from "next"; -const basePath = "/demo"; +const basePath = process.env.DEMO ? "/demo" : ""; const nextConfig: NextConfig = { - basePath, - assetPrefix: "/demo-assets", + ...(basePath ? { basePath, assetPrefix: "/demo-assets" } : {}), env: { NEXT_PUBLIC_BASE_PATH: basePath, }, diff --git a/vercel.json b/vercel.json index ced26d3924..f92a3f8a93 100644 --- a/vercel.json +++ b/vercel.json @@ -1,10 +1,3 @@ { - "framework": "nextjs", - "redirects": [ - { - "source": "/", - "destination": "/demo", - "permanent": false - } - ] + "framework": "nextjs" } From 98dbe89e6de08a467b8916e76492035b43c11df4 Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Fri, 20 Mar 2026 02:53:30 -0700 Subject: [PATCH 2/4] fix: use existing IS_DEMO env var instead of DEMO --- next.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.ts b/next.config.ts index 0833124126..e1f074bcbc 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,7 @@ import { withBotId } from "botid/next/config"; import type { NextConfig } from "next"; -const basePath = process.env.DEMO ? "/demo" : ""; +const basePath = process.env.IS_DEMO === "1" ? "/demo" : ""; const nextConfig: NextConfig = { ...(basePath ? { basePath, assetPrefix: "/demo-assets" } : {}), From dce8b5ab2c0bc1662381f603b4184e76cc5ed4a7 Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Fri, 20 Mar 2026 03:07:45 -0700 Subject: [PATCH 3/4] fix: move /demo redirect into next.config.ts behind IS_DEMO --- next.config.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/next.config.ts b/next.config.ts index e1f074bcbc..5bc2b32cd4 100644 --- a/next.config.ts +++ b/next.config.ts @@ -4,7 +4,15 @@ import type { NextConfig } from "next"; const basePath = process.env.IS_DEMO === "1" ? "/demo" : ""; const nextConfig: NextConfig = { - ...(basePath ? { basePath, assetPrefix: "/demo-assets" } : {}), + ...(basePath + ? { + basePath, + assetPrefix: "/demo-assets", + redirects: async () => [ + { source: "/", destination: basePath, permanent: false }, + ], + } + : {}), env: { NEXT_PUBLIC_BASE_PATH: basePath, }, From 008e5f5823eab54ccabb3131d284f264f8ba2b96 Mon Sep 17 00:00:00 2001 From: jeremyphilemon Date: Fri, 20 Mar 2026 03:16:00 -0700 Subject: [PATCH 4/4] fix: add basePath: false to redirect to prevent double prefixing --- next.config.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/next.config.ts b/next.config.ts index 5bc2b32cd4..d066f56356 100644 --- a/next.config.ts +++ b/next.config.ts @@ -9,7 +9,12 @@ const nextConfig: NextConfig = { basePath, assetPrefix: "/demo-assets", redirects: async () => [ - { source: "/", destination: basePath, permanent: false }, + { + source: "/", + destination: basePath, + permanent: false, + basePath: false, + }, ], } : {}),