From 07ffc3fade94a476c446d6b2baa367907627462a Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Mon, 2 Jun 2025 19:21:38 +0100 Subject: [PATCH] fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL (#21682) * fix: Remove hard dependency on NEXT_PUBLIC_API_V2_URL * turn spread into a push, simpler --- apps/web/next.config.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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,