Referencing another file within a function #33243
-
I have a Gatsby function that sends email (api/sendmail/sendmail.ts). When it executes, it needs to grab an EJS template file (api/sendmail/email_templates/template.ejs) to create the HTML email output. Included below are a few pieces of the Gatsby function to illustrate how I'm trying to do it. It works when running Gatsby locally, but when I push it to Netlify it can't find the file.
Is there a trick to referencing a file within a Gatsby function? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I also posted something similar on Netlify forums. https://answers.netlify.com/t/do-gatsby-functions-work-with-the-included-files-property/44363 |
Beta Was this translation helpful? Give feedback.
-
Gatsby functions only bundle files that you require. So instead of using |
Beta Was this translation helpful? Give feedback.
Gatsby functions only bundle files that you require. So instead of using
ejs.renderFile
, require the template and compile it and then useejs.render
.