Skip to content

Commit

Permalink
fix: differentiated runtime vs compile time NODE_ENV env var
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongliang02 committed Jan 3, 2025
1 parent 4005753 commit 12edae5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ if (!!process.env.SKIP_ENV_VALIDATION == false) {
// Otherwise it would just be returning `undefined` and be annoying to debug
if (!isServer && !prop.startsWith('NEXT_PUBLIC_'))
throw new Error(
['test', 'development'].includes(env.NODE_ENV)
['test', 'development'].includes(process.env.NODE_ENV)
? `❌ Attempted to access server-side environment variable '${prop}' on the client`
: '❌ Attempted to access a server-side environment variable on the client',
)
Expand Down
4 changes: 3 additions & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const MyApp = ((props: AppPropsWithAuthAndLayout) => {
<Stack spacing={0} minH="$100vh">
<VersionWrapper />
<ChildWithLayout {...props} />
<ReactQueryDevtools initialIsOpen={false} />
{['test', 'development'].includes(process.env.NODE_ENV) && (
<ReactQueryDevtools initialIsOpen={false} />
)}
</Stack>
</Suspense>
</ErrorBoundary>
Expand Down

0 comments on commit 12edae5

Please sign in to comment.