Closed gabrielmfern closed 1 week ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
react-email | β Failed (Inspect) | May 8, 2024 2:18pm | ||
react-email-demo | β Failed (Inspect) | May 8, 2024 2:18pm |
The problem
For some time, we had to remove the application inside
apps/demo
out of thepnpm-workspace.yaml
file due to an error, we had when using the workspace version ofreact-email
. This was caused by the workaround propertyserverComponentsExternalPackages
not working with a workspace version of a package.This property would make Next ignore that we were importing
react-dom/server
(which usually throws an error) so that the Next app would work when running for the users. But this property didn't seem to work when running a version of the package that was from the root workspace. This would cause it to throw errors, and since we could not find any way to force install the@react-email/render
from the registry, this error would always happen when we had thedemo
as a workspace.The solution
The solution to this was actually quite simple, and it also allows us to remove the
serverComponentsExternalPackages
configuration from the Preview server's Next config.To fix this, the only needed thing was to dynamically import the
@react-email/render
package insidereact-email
instead of doing it normally. This is also the same workaround we use inside therenderAsync
function from the@react-email/render
package.This PR also adds the
demo
into the workspaces, along with updating all of its dependencies to the latest canaries.How can I test this?
git checkout fix/demo-not-on-workspace
)pnpm install
andturbo build
inside ofapps/demo
pnpm dev
You can also check the demo vercel deploy that was just built from this, also running from the workspace version of
react-email
.