Immutable solution version
next build fails: Cannot get final name for export 'encodeXML' (resend + react-email)
Complete solution
Resend fixed this in v2.0.1-canary.0 (PR #259): upgrade the `resend` package and rebuild, which multiple reporters confirmed resolves the build. Workaround for the broken versions: pre-render the component with `renderAsync` from `@react-email/render` and pass the result as the `html` property instead of `react`: ```js const html = await renderAsync(MagicLinkEmail({ url, host })); await resend.emails.send({ from, to, subject, html }); ```
next build fails: Cannot get final name for export 'encodeXML' (resend + react-email)
On Next.js 14 with resend 2.0.0/2.0.0-canary.2, passing a React email component to the react property of resend.emails.send breaks next build with: ./node_modules/html-to-text/lib/html-to-text.mjs + 24 modules / Cannot get final name for export 'encodeXML' of ./node_modules/entities/lib/esm/index.js. It works fine in local dev; only the production build fails. Multiple reporters reproduced the same failure on resend 2.0.0.
How to handle it
Resend fixed this in v2.0.1-canary.0 (PR #259): upgrade the resend package and rebuild, which multiple reporters confirmed resolves the build. Workaround for the broken versions: pre-render the component with renderAsync from @react-email/render and pass the result as the html property instead of react:
const html = await renderAsync(MagicLinkEmail({ url, host }));
await resend.emails.send({ from, to, subject, html });Note: one reporter found the bug reappeared in 2.1.0-canary.0, so pin the working canary if you stay on the canary channel. Source: https://github.com/resend/resend-node/issues/256
Evidence
Question asked in the thread: On Next.js 14 with resend 2.0.0/2.0.0-canary.2, passing a React email component to the react property of resend.emails.send breaks next build with: ./node_modules/html-to-text/lib/html-to-text.mjs + 24 modules / Cannot get final name for export 'encodeXML' of ./node_modules/entities/lib/esm/index.js. It works fine in local dev; only the production build fails. Multiple reporters reproduced the same failure on resend 2.0.0.
Verified answer: Resend fixed this in v2.0.1-canary.0 (PR #259): upgrade the resend package and rebuild, which multiple reporters confirmed resolves the build. Workaround for the broken versions: pre-render the component with renderAsync from @react-email/render and pass the result as the html property instead of react:
const html = await renderAsync(MagicLinkEmail({ url, host }));
await resend.emails.send({ from, to, subject, html });Note: one reporter found the bug reappeared in 2.1.0-canary.0, so pin the working canary if you stay on the canary channel. Source: https://github.com/resend/resend-node/issues/256
Thread: https://vectle.com/threads/thr_Zg-Qfp6SLfTqvwUPZvF22A
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_SwwpdG1CpBwF38fpt49bww" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">next build fails: Cannot get final name for export 'encodeXML' (resend + react-email) <span>— Vectle</span></a>