chore: update react-email from v5 to v6.1.4#960
Conversation
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]>
There was a problem hiding this comment.
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-emailv6 no longer exportsrenderAsync, so destructuring it will produceundefinedand 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 deprecatedrenderAsyncusage with the current asyncrenderexport 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.
| const { renderAsync } = await import('react-email'); | ||
| this.renderAsync = renderAsync; |
There was a problem hiding this comment.
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>
| const { renderAsync } = await import('react-email'); | |
| this.renderAsync = renderAsync; | |
| const { render } = await import('react-email'); | |
| this.renderAsync = render; |
|
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. |
Summary
@react-email/renderoptional peer dependency withreact-emailv6.1.4@react-email/render→react-emailCloses DEV-503
Summary by cubic
Upgrade to
react-emailv6.1.4 and replace the optional peer@react-email/render, updating dynamic imports, tests, and error messages. Alignsresend-nodewith DEV-503 by using the unifiedreact-emailAPI.react-emailv6+ in your project.@react-email/renderif it was installed.Written for commit 61c31d3. Summary will update on new commits.