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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user