serverless-plugin-include-dependencies
serverless-plugin-include-dependencies copied to clipboard
Crashes when required file is not a module (like requiring a plain js)
/serverless-plugin-include-dependencies/get-dependency-list.js:82:66
const pathToModule = resolve.sync(path.join(moduleName, 'package.json'), { basedir });
throws an error that is uncaught, because moduleName is null:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
This basically makes it impossible to use when including custom code from a shared layer.
I've not got the time to do a fix and PR, but if anyone wants to do so, or just fix your copy for now, you can do by by editing get-dependency-list.js.
Find the two calls to handle() and wrap that in an IF statement: if (dependency.substring(0,5) !== "/opt/")
Very rough and ready, bit it will get you going for now.