How to load local image in Next JS 14 ? #1403
-
Hello everyone, thank you for this awesome library! Thanks in advance, Happy coding! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Have you tried to put in the public folder? If it's still not rendering, you can upload your local images on a supabase bucket or S3/any cdn and point it to the url |
Beta Was this translation helpful? Give feedback.
-
We have a section in the docs for the CLI on this. Take a look at https://react.email/docs/cli#where-can-i-place-my-static-files-for-previewing In the case of NextJS you will need to have your assets both in your const baseUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "";
export default function Email(props) {
return (
<div>
<img src={`${baseURL}/static/email-logo.png`} />
</div>
)
} |
Beta Was this translation helpful? Give feedback.
We have a section in the docs for the CLI on this. Take a look at https://react.email/docs/cli#where-can-i-place-my-static-files-for-previewing
In the case of NextJS you will need to have your assets both in your
public
folder, and in youremail/static
, and then you should have something like, in the case of hosting on Vercel: