Impossible to use the dev server/preview functionality within an existing project #598
Replies: 7 comments 5 replies
-
Here's an example with React Email + Next.js + Resend where you put all your emails in a folder (transactional) and still be able to import that email in your server. And here if you don't want to use the |
Beta Was this translation helpful? Give feedback.
-
Can we use with react for sengrid or it's resend specific? |
Beta Was this translation helpful? Give feedback.
-
Thanks @bukinoshita, that's a reasonable workaround for now. I think it'd still be worth the investment to create a self-contained preview server script within Mailing has a similar offering that can do this in one command ( |
Beta Was this translation helpful? Give feedback.
-
I don't think Sendgrid support react, but you can use the |
Beta Was this translation helpful? Give feedback.
-
Not really sure if I understood correctly, doesn't the |
Beta Was this translation helpful? Give feedback.
-
Want to +1 this -- it is a little annoying to create basically a completely separate app within my existing Next app to get this to work. Would be much nicer if I could just install |
Beta Was this translation helpful? Give feedback.
-
How about for applications other than next.js? I have a scenario where we have a standalone node/express server. This server sends transactional emails, and populates the email data at runtime. I have tried the same approach suggested above, but I'm unsuccessful in configuring my node server to render the email templates. Here's some example code:
Note, I have tried installing both react and react-dom on my node server. The error I receive is Any suggestions? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the Bug
All the documentation recommends installing
react-email
into a new, fresh package – why is that?Presumably the workflow a lot of people would want is to be able to build emails with
react-email
, and then send them with existing logic they have in their code base. We're usingnodemailer
and some frankenstein HTML generation code right now and would like to replace it. But if all thereact-email
stuff is in its own package (package A), how would one use therender()
functionality to generate a templatized email from within an existing codebase (package B)?Despite the docs' recommendation, I tried to get this working within our existing package, but since it's trying to copy over dependencies from my existing
package.json
and also merge them with requirements from thereact-email
template side of things, we get stuck in dependency hell.Which package is affected (leave empty if unsure)
No response
Link to the code that reproduces this issue
can't share
To Reproduce
react-email
and@react-email/components
dependencies to an existing NextJS projectpackage.json
package.json
:"email": "email dev",
npm run email
Since we're using next 12 and
react-email
stubs in several next 13 dependencies, we get a ton of warnings like the following:I tried to edit the
.react-email/package.json
to more closely match the minimal one when doingnpx create-email
- but it just overwrites my changes and uses what it wants.Expected Behavior
🤷🏻♂️ I think the existing preview dev server infrastructure needs reworked because this is pretty painful. Rather than creating an entire subproject with its own set of dependencies,
react-email
should be able to compile and serve the preview server with a single commandWhat's your node version? (if relevant)
No response
Beta Was this translation helpful? Give feedback.
All reactions