-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(client): Support external file imports inside of email components #615
Conversation
General feedback:
which was quick awkward. I assume that you have some monorepo setup somewhere that solves this nicely, but I could not find it. Maybe you can provide a guide on how to do it properly (or point me to an existing one) |
76f2bf4
to
48fe257
Compare
I just noticed that this might be a breaking change if people have reusable components inside /emails/, like
I could limit the import to not go over the emails folder recursively. Are folders within the emails directory officially supported?
|
4e05380
to
213a0b2
Compare
Yeah, this should allow importing components or other files from emails or outside emails. |
I was working on this branch successfully the last couple of days :)
|
Yeah, I think so for now. Because we're only copying the emails/static folders. |
@bukinoshita I limited it to only use the files from the emails directory directly 🙂 |
Oh I also noticed something different: I think this also solves automatic reload when changing files. At least I had a lot of problems before working on this branch and now it just works. :) |
Nice, thanks! |
@EyMaddis Sorry for the delay, can you check the conflicts? |
… fix/external-imports # Conflicts: # packages/react-email/source/utils/generate-email-preview.ts
@bukinoshita Done :) |
Hey, thanks for your work on this PR. When will this get packaged and released to NPM? Says last release was 14 days ago. Just looking to use components with react-email in my project and this has been a roadblock. |
This PR implements a fix for #613.
React Email should now be able to preview files that container imports like
import Theme from '../src/theme'
(sibling directory of/emails
).In order to do this, email files are no longer copied over to the
.react-email/emails/
folder but instead files are created which only re-export their default export, like so:.react-email/emails/my-template.tsx
:Also resolves that static files where not copied over correctly and throwing an error every time.