From 3c3bbd3a93fef9d5d26ca9784423bd0af4e9d759 Mon Sep 17 00:00:00 2001 From: gabriel miranda Date: Thu, 12 Sep 2024 14:47:10 -0300 Subject: [PATCH] fix(react-email): NODE_ENV for emails as "PRODUCTION" --- .changeset/gorgeous-ravens-tease.md | 5 +++++ .../react-email/src/cli/utils/preview/start-dev-server.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/gorgeous-ravens-tease.md diff --git a/.changeset/gorgeous-ravens-tease.md b/.changeset/gorgeous-ravens-tease.md new file mode 100644 index 0000000000..cd8a44f311 --- /dev/null +++ b/.changeset/gorgeous-ravens-tease.md @@ -0,0 +1,5 @@ +--- +"react-email": patch +--- + +Fix NODE_ENV for emails as "PRODUCTION" instead of "DEVELOPMENT" diff --git a/packages/react-email/src/cli/utils/preview/start-dev-server.ts b/packages/react-email/src/cli/utils/preview/start-dev-server.ts index 045d717e84..c307205112 100644 --- a/packages/react-email/src/cli/utils/preview/start-dev-server.ts +++ b/packages/react-email/src/cli/utils/preview/start-dev-server.ts @@ -120,6 +120,7 @@ export const startDevServer = async ( // this is the most reliable way of communicating these paths through process.env = { ...process.env, + NODE_ENV: "development", ...getEnvVariablesForPreviewApp( // If we don't do normalization here, stuff like https://github.com/resend/react-email/issues/1354 happens. path.normalize(emailsDirRelativePath),