diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 7f5e657b3c..255c1c2a2b 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -48,10 +48,6 @@ if (!process.env.EMAIL_FROM) { if (!process.env.NEXTAUTH_URL) throw new Error("Please set NEXTAUTH_URL"); -if (!process.env.NEXT_PUBLIC_API_V2_URL) { - console.error("Please set NEXT_PUBLIC_API_V2_URL"); -} - const getHttpsUrl = (url) => { if (!url) return url; if (url.startsWith("http://")) { @@ -335,10 +331,6 @@ const nextConfig = { ].filter(Boolean); let afterFiles = [ - { - source: "/api/v2/:path*", - destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`, - }, { source: "/org/:slug", destination: "/team/:slug", @@ -375,6 +367,13 @@ const nextConfig = { }, */ ]; + if (Boolean(process.env.NEXT_PUBLIC_API_V2_URL)) { + afterFiles.push({ + source: "/api/v2/:path*", + destination: `${process.env.NEXT_PUBLIC_API_V2_URL}/:path*`, + }); + } + return { beforeFiles, afterFiles,