Using require to include a relative module in Netlify Functions on Node

Hello, as i understand, Netlify Functions on Node cannot require relative modules and only work with modules from node_modules directory. Is there any clever way to import external files besides adding a compilation step to obtain a single file?

Hi @matteo-rigon, our buildbot has the zip-it-and-ship-it module built in. On that repo’s readme file mentions the ability to zip your function with any dependencies. Let me know if that works for you.

Thanks Dennis, that’s exacly what i was looking for!

1 Like