Reduce Node.js lambda package so it contains only lambda dependencies
Plugin for Serverless v1
By default Serverless packages whole contents of service folder in which lambda was configured, it raises issues in projects where we maintain many functions under one service.
This plugin ensures that it is only dependencies of given lambda that are packaged and deployed to remote instance
$ npm install serverless-plugin-reducer
- Ensure individual functions packaging by setting
packagegroup. (See Packaging functions separately)
- Activate plugin in
- If there ar some files that need to be included but escape automatic dependencies resolution (e.g. non Node.js module files, or modules required through dynamically resolved paths) they need to be included through
includeoption as e.g.
functions:hello:handler: handler.hellopackage:include:- non-node-js-module.txt- required-through-dynamic-path.js
- If for some paths module files cannot be found, by default an informative error is thrown. Still if the cases are safe to ignore, you may silence those errors with: