-
Notifications
You must be signed in to change notification settings - Fork 889
Description
Describe the Bug
Opening an issue since it was suggested to do that first instead of just opening a pull request 😄
I am trying to render an email in the browser but the react server is not imported properly (see reproduction) 🙂 I have solved this locally by patching the package and changing this line like this:
- const reactDOMServer = await import('react-dom/server');
+ const reactDOMServer = (await import('react-dom/server')).default;This issue is that importing modules dynamically in the browser returns a Module and not the default export which typescript seem to suggest. Not sure if typescript can be reconfigured to reflect this, or if there's a better solution than this. The tests seem to pass and I can use the render function when trying out the fix locally at least!
Which package is affected (leave empty if unsure)
@react-email/render
Link to the code that reproduces this issue
https://stackblitz.com/edit/vitejs-vite-8gysj2qp?file=src%2Fmain.tsx
To Reproduce
Use the render function in a browser.
Expected Behavior
The email is rendered to HTML.
What's your node version? (if relevant)
No response