Skip to content

Commit 1748335

Browse files
AshotNdependabot[bot]gabrielmfern
committed
fix(react-email): Respect user NODE_ENV (#1756)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: gabriel miranda <[email protected]>
1 parent c427c60 commit 1748335

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/early-mugs-divide.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-email": patch
3+
---
4+
5+
Respect user's NODE_ENV when previewing templates

packages/react-email/src/cli/utils/preview/start-dev-server.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ export const startDevServer = async (
119119
// these environment variables are used on the next app
120120
// this is the most reliable way of communicating these paths through
121121
process.env = {
122-
...process.env,
123122
NODE_ENV: 'development',
123+
...(process.env as Omit<NodeJS.ProcessEnv, 'NODE_ENV'> & {
124+
NODE_ENV?: NodeJS.ProcessEnv['NODE_ENV'];
125+
}),
124126
...getEnvVariablesForPreviewApp(
125127
// If we don't do normalization here, stuff like https://github.com/resend/react-email/issues/1354 happens.
126128
path.normalize(emailsDirRelativePath),

0 commit comments

Comments
 (0)