-
Notifications
You must be signed in to change notification settings - Fork 664
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
Tailwind doesn't recognize the Head component when NODE_ENV="production" #1112
Comments
Can you give a reproduction for this issue? |
Really can't reproduce this issue, could any of you give a minimal reproduction @xonx4l @laurisbernhart? |
Hi, I have been running into the same issue, and have created a minimal reproduction. It's a NextJS project, where react-email works in dev-mode ( In dev-mode, you can see that the response renders fine at http://localhost:3000/email-media. However, when building for production, it fails:
Using The relevant react-email code is here: https://github.com/zegl/react-email-tailwind/blob/main/src/app/email-media/route.tsx |
As a temporary workaround you can downgrade to |
Thanks @zegl for the repro, I'll look into this right now. The issue is probably because we check for either the |
@zegl Would you consider checking this plugin out https://www.npmjs.com/package/webpack-react-component-name? I think using it can be a workaround on this for now and it may confirm my suspicion for what is causing the issue here. |
@gabrielmfern I tried, but I haven't been able to get it to work with the |
I installed just |
A better temporary workaround is to use the element substituting the component for now. If you want the same exact code and behavior as the component gives, you can get its code here: react-email/packages/head/src/head.tsx Lines 8 to 11 in bb8cd54
Haven't fixed this quite yet because of #1124. |
Fixed and released under If any of you still experience this issue, please let me know and I'll reopen. |
First, thanks for improving the email DX so much with this library🙌
Describe the Bug
When using the Head component as a direct child of Tailwind:
If NODE_ENV is set to production, I receive the following error:
Tailwind: To use responsive styles you must have a element as a direct child of the Tailwind component.
If NODE_ENV is set to development, it will work as expected.
Does not work in production:
Workaround
Using a normal head tag works when NODE_ENV is set to production.
Without digging deeper and trying it out, my best guess is that this check fails in production
react-email/packages/tailwind/src/tailwind.tsx
Lines 181 to 183 in 778f3b0
Best Lauris
What's your node version? (if relevant)
v18.16.0
The text was updated successfully, but these errors were encountered: