smaller-modules
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

smaller-modules

Shrink node_modules for deployment

Introduction

An illustration of the heaviest objects in the universe

Are you having problems getting node_modules down to a reasonable size?

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?

An error occurred (InvalidParameterValueException) when calling the UpdateFunctionCode operation: Unzipped size must be smaller than 262144000 bytes

Here's a utility that might help.

Quickstart

Zip up node_modules for Lambda

smaller-modules --zip --file dist/handler.js

Copy dependencies of compiled output to a new directory

smaller-modules --copy --directory dist --output-subdirectory smaller_modules

List dependencies of a .js file

smaller-modules --list --file dist/index.js --output-path dependencies.txt

or print it to the command line

smaller-modules --list --file dist/index.js

Usage

Zip up node_modules for Lambda (in long-hand)

smaller-modules --zip --file dist/index.js --output-subdirectory nodejs --output-path node_modules.zip

Use with packages in a mono-repository

# Run from packages/<package-name>
smaller-modules --list --file dist/index.js --base "../.." 

Package Sidebar

Install

npm i smaller-modules

Weekly Downloads

351

Version

0.3.0

License

MIT

Unpacked Size

121 kB

Total Files

23

Last publish

Collaborators

  • eliot_lim