Skip to content

Conversation

TyMick
Copy link
Contributor

@TyMick TyMick commented Sep 26, 2025

Fixes #2420.

@MrMaxie's intuition was right on—replacing backslashes with forward slashes in absolute paths in the next.config.js template fixes Windows builds on my end.

Before this change, if I run the following on Windows:

pnpm create email
cd react-email-starter
pnpm i
pnpm build

it fails during the Next.js build, citing a very mangled version of the project path in the error message.

After this change, if I Yalc my local react-email package into my react-email-starter project, the build succeeds!


Summary by cubic

Normalizes Windows paths in the generated Next.js config to fix build failures on Windows. Replaces backslashes with forward slashes in absolute paths used during react-email builds.

  • Bug Fixes
    • Convert backslashes in process.cwd() and builtPreviewAppPath before writing next.config.js.
    • Prevents mangled path errors during Next.js build on Windows (react-email-starter).

Copy link

changeset-bot bot commented Sep 26, 2025

🦋 Changeset detected

Latest commit: 8808122

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
react-email Patch
@react-email/preview-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 26, 2025

@TyMick is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

pkg-pr-new bot commented Sep 26, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email@2475

commit: 8808122

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

@TyMick TyMick force-pushed the normalize-windows-paths-nextjs branch from 5abdcf1 to 5a07aaf Compare September 26, 2025 05:53
@gabrielmfern
Copy link
Member

Amazing work, thank you very much for this!

@gabrielmfern gabrielmfern changed the title fix(react-email): Normalize Windows paths in generated Next.js config fix(react-email): broken paths on email build output for Windows Sep 26, 2025
@gabrielmfern gabrielmfern merged commit 90f39d5 into resend:canary Sep 26, 2025
7 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect path resolving in generated code on Windows

2 participants