-
Notifications
You must be signed in to change notification settings - Fork 758
Hot Reload not working when modifying components imported in the email files (when using path aliases) #1872
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
Comments
We do support hot reloading for changing files imported into an email template, but we don't support TypeScript's path aliases, that seems to be the issue in your case. |
@gabrielmfern Thanks for the clarification. Will it be supported in the future? I'm sure path aliases are widely used. |
Hot Reloading also does not work for subpath imports such as, for example: import Button from '#common/emails/_components/Button.js' |
Similar to what @Charioteer said. Hot reloading doesn't seem to work for ESM/Typescript projects in general. |
I came across a similar issue. If I imported my component like
At which point it would just hang, but if I restarted the dev server then all would be fine. I've now switched to the default export from my component file, so I import like
|
I was seeing a similar issue as @smallbellows. As long as I export a default from each of my components, I no longer get that error and hot module reloading appears to work with one caveat. the CLI shows that it failed to when rendering my child component but then shows the re-render of the full template working as expected. ✖ Failed while rendering AgentInfo.tsx
✔ Successfully rendered market-report.tsx in 242ms relevant package versions {
"@react-email/components": "0.0.35",
"react-email": "4.0.3",
"react": "18.3.1",
"react-dom": "18.3.1",
} |
Same here. as a workaround just make sure all your files you import from have any |
I'm not sure if it's the same issue, but I’ve encountered the following problem: |
The hot reload is not working in a monorepo (Turborepo) which the components are in another package in the repo. EX:
The component is imported as follows: import { Component } from "@repo/templates"; I've tried the default export/import, but seems not to be supported ether. |
Can you all try this with |
I can confirm my case is fixed. Thanks 🙏 |
@a-gunderin I tracked this myself at #2242 |
Describe the Bug
I have the following file structure:
When I modify anything in
footer.tsx
(orlayout.tsx
), the dev server outputs✔ Successfully rendered footer.tsx in 236ms
but does not re-rendergeneric.tsx
that imports both of those components.Which package is affected (leave empty if unsure)
react-email
Link to the code that reproduces this issue
https://github.com/NickTiut/react-email-bug
To Reproduce
Run
npm run dev
on the example provided. Modify anything in the_components/layout.tsx
or_components/footer.tsx
files. Web client does not update. If you restart the dev server, the changes are picked up.Expected Behavior
Any change to the components should be reflected instantly on the web client.
What's your node version? (if relevant)
20.4.0
The text was updated successfully, but these errors were encountered: