How to import React Mail component into Next.js api route? - Module not found. #1760
Replies: 1 comment
-
Why did you close this? Were you able to fix it? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having an issue where react mail component can't be use inside the api route or server action. The error is that
Module not found: Can't resolve '@/components/emailTemplate/sendFileEmailTemplate'
This only happened in production, I assumed that the way route and API render or build before all the component. that's why it can't find a module.
What is the correct way to import react mail into the api route?
ps. I need to do this in the server action or route handler as Next.js will throw an error if trying to call
new Resend(API_KEY)
on the client side.If anyone experienced this, please suggest.
thank you!!
Beta Was this translation helpful? Give feedback.
All reactions