From 70825dd13885d3e48084841dfe80cc554773470a Mon Sep 17 00:00:00 2001 From: chauhan_s Date: Sat, 25 Oct 2025 20:38:48 +0530 Subject: [PATCH] fix: define process.env variables in atoms vite config to prevent 'process is undefined' errors (#24665) - Add all process.env variables used by Next.js code to the define section - This ensures they are replaced at build time and don't cause runtime errors in Vite projects - Fixes #24213 Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- packages/platform/atoms/vite.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/platform/atoms/vite.config.ts b/packages/platform/atoms/vite.config.ts index 4cbf2b5376..7c6d9593e7 100644 --- a/packages/platform/atoms/vite.config.ts +++ b/packages/platform/atoms/vite.config.ts @@ -38,6 +38,14 @@ export default defineConfig(({ mode }) => { ], define: { "process.env.NEXT_PUBLIC_WEBAPP_URL": `"${webAppUrl}"`, + "process.env.NODE_ENV": `"${mode}"`, + "process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA": `"${env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA ?? ""}"`, + "process.env.NEXT_PUBLIC_CALCOM_VERSION": `"${env.NEXT_PUBLIC_CALCOM_VERSION ?? ""}"`, + "process.env.__NEXT_ROUTER_BASEPATH": `""`, + "process.env.__NEXT_I18N_SUPPORT": `false`, + "process.env.__NEXT_MANUAL_TRAILING_SLASH": `false`, + "process.env.__NEXT_TRAILING_SLASH": `false`, + "process.env": "{}", }, ssr: { noExternal: ["turndown"], // Example if you want to disable SSR for your library