Open alvindivina08 opened 5 months ago
I encountered the same error when running inside Next.js (latest version).
After adding "use client"
on the top of the tsx
file which includes renderToStaticMarkup(CONFIGURATION, { rootBlockId: 'email-builder-root' });
, new error encountered:
TypeError: Cannot read properties of undefined (reading 'Component')
> 14 | const string = renderToStaticMarkup(CONFIGURATION, { rootBlockId: 'email-builder-root' });
I have tried to work with renderToStaticMarkup
(from react/server
) and it works great, but I have no idea how to continue debugging..
I created an api that separates renderToStaticMarkUp from the next js main codebase. Now my app works fine and calls an api if it needs to convert json to html
Hi @alvindivina08, is it possible to share some details on how to resolve this issue?
Thanks a lot! ❤️
I have it in my repo and deployed it using vercel. Feel free to take a look and copy it
Thanks a lot!
I remember us having this issue in the early days of the project and we fixed it in this PR https://github.com/usewaypoint/email-builder-js/pull/91/files that uses react-dom/server as a peer dependency and wraps with this function https://github.com/usewaypoint/email-builder-js/blob/1245bdac807e0989babcd4b2db1bc3a2a3bbf376/packages/email-builder/src/renderers/renderToStaticMarkup.tsx
That PR seemed to solved this issue for a couple of people.
First of all, thank you for making this open source!
is there any alternative to renderToStaticMarkup for NextJS?
I keep getting this error when I'm trying to compile it to a production build using NextJs