Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(render): pretty option breaks CJS builds #1866

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/early-mugs-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-email": patch
---

Respect user's NODE_ENV when previewing templates
5 changes: 5 additions & 0 deletions .changeset/purple-teachers-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-email/render": patch
---

Fixes `pretty` option breaking CJS projects
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ export const startDevServer = async (
// these environment variables are used on the next app
// this is the most reliable way of communicating these paths through
process.env = {
...process.env,
NODE_ENV: 'development',
...(process.env as Omit<NodeJS.ProcessEnv, 'NODE_ENV'> & {
NODE_ENV?: NodeJS.ProcessEnv['NODE_ENV'];
}),
...getEnvVariablesForPreviewApp(
// If we don't do normalization here, stuff like https://github.com/resend/react-email/issues/1354 happens.
path.normalize(emailsDirRelativePath),
Expand Down
2 changes: 1 addition & 1 deletion packages/render/src/shared/utils/pretty.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { format } from "prettier/standalone";
import html from "prettier/plugins/html";
import * as html from "prettier/plugins/html";
import type { Options } from "prettier";

const defaults: Options = {
Expand Down
Loading