Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(render): Issue with ESM due to dyanmic require #1491

Merged
merged 11 commits into from
Jun 6, 2024

Conversation

gabrielmfern
Copy link
Collaborator

This is intended for #1486. The issue was that we were using a require to
dynamically import in the Node stream module so that we could read through
react-dom's stream only when running in Node, and since we wanted for this to
work on the browser as well, we compromised into using a dynamic require.

The issue with that was that, in ESM-only builds, this was erroring with stuff like:

Error: Dynamic require of "stream" is not supported

The more optimal way of doing what we tried doing there is to have a different
build for the browser and for Node so that we can just import and avoid having
to dynamically do so. This PR does exactly that, and it should fix these issues.
It does make it a bit more complicated in the exports section of the
package.json though, so it is something to consider.

Copy link

vercel bot commented Jun 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-email ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2024 5:18pm
react-email-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2024 5:18pm

@gabrielmfern gabrielmfern merged commit 3699e26 into canary Jun 6, 2024
9 checks passed
@gabrielmfern gabrielmfern deleted the fix/esm-issue-with-render branch June 6, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants