Closed sandrocsimas closed 1 month ago
Thanks for pointing this out, this is because we parse the email templates using babel ourselves to generate a dependency tree based on what they import so that we can determine when to hot-reload email templates or not. This means that, even with the plugin you added in, you will get the error because when we parse it with babel it won't look for a configuration file at all.
The solution then is going to be adding that decorators
plugin to our internal babel instance and it should be fixed.
One question I have is, are you using Babel yourself here? Or was it just a workaround you were trying? I can reproduce the issue without any .babelrc
, but by just using any sort of decorators in any template.
Can you try this out again on react-email@2.1.7-canary.2
? Just released a new version with the fix.
I'm not using babel, only typescript. I just tried to fix the problem by adding a new .babelrc and installing babel dependency. Thanks for the fix. I'll test it as soon as I can.
@gabrielmfern Sorry for the delay, it is now working fine. Thanks!
@sandrocsimas Nice! Closing it as as completed.
Describe the Bug
Versions:
I have the following script in my
package.json
:"emails:preview": "email dev --dir ./src/cloud/mailer --port 4000"
When I run
yarn emails:preview
I get the following error:My
tsconfig.json
hasemitDecoratorMetadata
andexperimentalDecorators
as true.I also tried adding a
.babelrc
file in my project:Which package is affected (leave empty if unsure)
react-email
Link to the code that reproduces this issue
The project is private, but let me know if you need it, so I can create an example project..
To Reproduce
.babelrc
with the code I mentioned in the description;emitDecoratorMetadata
andexperimentalDecorators
intsconfig.json
;Expected Behavior
The command
email dev
to work correctly and be able to preview the emails.What's your node version? (if relevant)
v20.11.0