Skip to content

chore: update react-email from v5 to v6.1.4#960

Open
dielduarte wants to merge 1 commit into
canaryfrom
feature/dev-503-update-resend-node
Open

chore: update react-email from v5 to v6.1.4#960
dielduarte wants to merge 1 commit into
canaryfrom
feature/dev-503-update-resend-node

Conversation

@dielduarte
Copy link
Copy Markdown
Contributor

@dielduarte dielduarte commented May 13, 2026

Summary

  • Replace @react-email/render optional peer dependency with react-email v6.1.4
  • Update dynamic imports and mocks from @react-email/renderreact-email

Closes DEV-503


Summary by cubic

Upgrade to react-email v6.1.4 and replace the optional peer @react-email/render, updating dynamic imports, tests, and error messages. Aligns resend-node with DEV-503 by using the unified react-email API.

  • Migration
    • Install react-email v6+ in your project.
    • Remove @react-email/render if it was installed.

Written for commit 61c31d3. Summary will update on new commits.

Replace @react-email/render peer dependency with react-email v6.
Update all dynamic imports and mocks to use the unified react-email package.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@dielduarte dielduarte requested a review from a team as a code owner May 13, 2026 22:09
@dielduarte dielduarte requested a review from danilowoz May 13, 2026 22:09
Copy link
Copy Markdown
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.

cubic analysis

1 issue found across 4 files

Confidence score: 2/5

  • There is a high-confidence regression risk in src/templates/templates.ts: react-email v6 no longer exports renderAsync, so destructuring it will produce undefined and likely break template rendering at runtime.
  • The issue is user-impacting and fairly concrete (severity 8/10, confidence 9/10), which pushes this below a safe-to-merge level until the API usage is updated to render.
  • Pay close attention to src/templates/templates.ts - replace deprecated renderAsync usage with the current async render export to avoid runtime failures.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/templates/templates.ts">

<violation number="1" location="src/templates/templates.ts:57">
P1: `react-email` v6 removed the deprecated `renderAsync` export (via `@react-email/render` v2.0.0) and now exports `render`, which is always async. Destructuring `renderAsync` from the `react-email` module returns `undefined`, so `this.renderAsync` remains `undefined` after the import and `await this.renderAsync(...)` will throw a `TypeError` at runtime.</violation>
</file>

Linked issue analysis

Linked issue: DEV-503: Update: resend-node

Status Acceptance criteria Notes
Update package.json to replace peer dependency '@react-email/render' with 'react-email' (including peerDependenciesMeta optional flag) package.json diff replaces @react-email/render with react-email and marks react-email as optional in peerDependenciesMeta.
Update dynamic import and type usage in src/render.ts to import from 'react-email' and update error message src/render.ts now imports render from 'react-email' and the thrown error message references `react-email`.
Update dynamic import in src/templates/templates.ts to import renderAsync from 'react-email' and update error message src/templates/templates.ts now dynamically imports renderAsync from 'react-email' and the error message was updated to mention `react-email`.
Update tests/mocks to mock 'react-email' instead of '@react-email/render' templates.spec.ts changes vi.mock('@react-email/render'...) to vi.mock('react-email'...), updating the test mock target.

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment on lines +57 to 58
const { renderAsync } = await import('react-email');
this.renderAsync = renderAsync;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: react-email v6 removed the deprecated renderAsync export (via @react-email/render v2.0.0) and now exports render, which is always async. Destructuring renderAsync from the react-email module returns undefined, so this.renderAsync remains undefined after the import and await this.renderAsync(...) will throw a TypeError at runtime.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/templates/templates.ts, line 57:

<comment>`react-email` v6 removed the deprecated `renderAsync` export (via `@react-email/render` v2.0.0) and now exports `render`, which is always async. Destructuring `renderAsync` from the `react-email` module returns `undefined`, so `this.renderAsync` remains `undefined` after the import and `await this.renderAsync(...)` will throw a `TypeError` at runtime.</comment>

<file context>
@@ -54,11 +54,11 @@ export class Templates {
       if (!this.renderAsync) {
         try {
-          const { renderAsync } = await import('@react-email/render');
+          const { renderAsync } = await import('react-email');
           this.renderAsync = renderAsync;
         } catch {
</file context>
Suggested change
const { renderAsync } = await import('react-email');
this.renderAsync = renderAsync;
const { render } = await import('react-email');
this.renderAsync = render;

@dielduarte dielduarte removed the request for review from danilowoz May 13, 2026 22:17
@dielduarte
Copy link
Copy Markdown
Contributor Author

pls do not review this one yet, it was supposed to be a draft pr. I will need to discuss this one with the team because react email is a peer deps here, meaning if we require the version 6, this one will need to be a major version of the sdk.

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.

1 participant