I am trying to use shopify-api-node
in my Netlify functions but I’m facing MODULE_NOT_FOUND
errors because the library uses dynamic imports.
Netlify provides the included_files
property to allow for the manual addition of files.
However, even after including the entire library like so included_files = ["node_modules/shopify-api-node/**"]
, I am still facing MODULE_NOT_FOUND
errors for third-party libraries such as lodash
which are imported by shopify-api-node
via static imports.
I can fix these errors by adding lodash
to included_files
but it would be a dramatically better developer experience if Netlify analyzed the included_files
for static imports like it does for other dependencies which are discovered naturally.
What makes this worse is that netlify dev
runs flawlessly and the MODULE_NOT_FOUND
errors only manifest on production.