diff --git a/next.config.ts b/next.config.ts index 32eeb60ef1..d066f56356 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,11 +1,23 @@ import { withBotId } from "botid/next/config"; import type { NextConfig } from "next"; -const basePath = "/demo"; +const basePath = process.env.IS_DEMO === "1" ? "/demo" : ""; const nextConfig: NextConfig = { - basePath, - assetPrefix: "/demo-assets", + ...(basePath + ? { + basePath, + assetPrefix: "/demo-assets", + redirects: async () => [ + { + source: "/", + destination: basePath, + permanent: false, + basePath: false, + }, + ], + } + : {}), 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" }