I have a similar issue to
https://community.netlify.com/t/using-require-to-include-a-relative-module-in-netlify-functions-on-node/4177, but it is around the discovery of dependencies from a relative import.
I’m working on bringing Netlify support to Bison. Under the hood it uses Next.js and I was trying to leverage the next-on-netlify package. My api function imports a relative module outside the function directory that has a dependency on
At run-time it fails with the following error:
After doing a bit of research and trying multiple approaches, it appears that the file locations are the problem. But, only from the standpoint that the Netlify builder does not include the dependency. Is there anything I can do outside of manually zipping the file with https://github.com/netlify/zip-it-and-ship-it#usage?
I don’t want to move the modules into
pages/api because I don’t want them to build as separate functions.
I’ve also tried explicitly requiring
@nexus/schema in the
pages/api/graphql.ts file, but that didn’t help.