feat(render): use experimental react-markup on react-server export #2689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was experimenting with
next-intland callinggetTranslationsfails in the preview server:Because we don't import from the
react-servercondition when bundling withesbuildfor previewing.But if we did,
react-domwould also fail because the code exported through thereact-servercondition isThis is because
react-domis really not meant to run in areact-serverenvironment, 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-serveris if we usereact-markupourselves with thereact-servercondition 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
Dependencies
Written for commit 4e64f10. Summary will update automatically on new commits.