Shrink node_modules for deployment
npm install smaller-modulesShrink node_modules for deployment
!An illustration of the heaviest objects in the universe
Are you having problems getting node_modules down to a reasonable size?
``text`
An error occurred (RequestEntityTooLargeException) when calling the UpdateFunctionCode operation: Request must be smaller than 69905067 bytes for the UpdateFunctionCode operation
Do you hit size limits, even when creating separate layers to contain dependencies?
`text`
An error occurred (InvalidParameterValueException) when calling the UpdateFunctionCode operation: Unzipped size must be smaller than 262144000 bytes
Here's a utility that might help.
for Lambda`bash`
smaller-modules --zip --file dist/handler.js
`bash`
smaller-modules --copy --directory dist --output-subdirectory smaller_modules
file`bash`
smaller-modules --list --file dist/index.js --output-path dependencies.txt
`bash`
smaller-modules --list --file dist/index.js
for Lambda (in long-hand)`bash`
smaller-modules --zip --file dist/index.js --output-subdirectory nodejs --output-path node_modules.zip
`bash``Run from packages/
smaller-modules --list --file dist/index.js --base "../.."