Skip to content

mjs build uses require #1486

@kentcdodds

Description

@kentcdodds

Describe the Bug

The module at @react-email/render/dist/index.mjs attempts to use require which is not supported in a native ESM environment (it's an mjs file so it's native ESM).

As a result, when calling renderAsync, you get the following error:

Error: Dynamic require of "stream" is not supported

This is because require is not defined in a module using native ESM.

Which package is affected (leave empty if unsure)

@react-email/render

Link to the code that reproduces this issue

epicweb-dev/epic-stack#749

To Reproduce

Attempt to use renderAsync with the mjs build.

Expected Behavior

It renders properly without error.

What's your node version? (if relevant)

v20.13.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions