Skip to content

Conversation

@gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Nov 14, 2025

I was experimenting with next-intl and calling getTranslations fails in the preview server:

Error: `getTranslations` is not supported in Client Components.
    at <unknown> (emails/my-email-template.tsx:82803:11)
    at MyEmailTemplate (emails/my-email-template.tsx:82819:20)

Because we don't import from the react-server condition when bundling with esbuild for previewing.

But if we did, react-dom would also fail because the code exported through the react-server condition is

'use strict';

throw new Error(
  'react-dom/server is not supported in React Server Components.'
);

This is because react-dom is really not meant to run in a react-server environment, and that's also why we, to this day, still get errors when running in Next.js 15+ edge (see vercel/next.js#71865 (comment)).

For that reason, the React team started developing react-markup, which is still experimental. The only way for us to prefer react-server is if we use react-markup ourselves with the react-server condition for @react-email/render. Since this is experimental, and we're trying out solutions we can have this at least in canary.

The preview release from this PR also lets us play around


Summary by cubic

Add a react-server export for @react-email/render that uses experimental react-markup to render HTML in RSC environments. This fixes preview/Next.js RSC failures (e.g., next-intl getTranslations) by avoiding react-dom/server.

  • New Features

    • New "react-server" export that renders via react-markup with Suspense.
    • Added conditional exports and build output for react-server to replace legacy server rendering in previews/Next RSC.
    • Supports plain text output and handles large emails without hydration markers and high-byte characters.
  • Dependencies

    • Added react-markup 0.0.0-experimental-93fc5740-20251113.

Written for commit 4e64f10. Summary will update automatically on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

⚠️ No Changeset found

Latest commit: 4e64f10

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-email Ready Ready Preview Comment Nov 14, 2025 0:58am
react-email-demo Ready Ready Preview Comment Nov 14, 2025 0:58am

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 14, 2025

Open in StackBlitz

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

commit: 4e64f10

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.

2 participants