Shake the dependency tree and only package files needed
Shake the file dependency tree and only include files needed.
yarn add --dev serverless-plugin-tree-shake
npm install --save-dev serverless-plugin-tree-shake
plugins: - serverless-plugin-tree-shake package: # no need to spend time excluding dev dependencies, given that # serverless-plugin-tree-shake does it already excludeDevDependencies: false
example output before (with
$ time sls package 33.93s user 20.17s system 82% cpu 1:05.94 total
$ tree 988 directories, 5978 files
example output after:
$ time sls package 3.77s user 1.27s system 51% cpu 9.724 total
$ tree 24 directories, 48 files
This plugins supports typescript natively. It uses the installed typescript package, reads the appropriate config, and transpiles to js according to that config. You can see examples on the
__fixtures__ that start with
This plugins supports bundling functions
individually. Just use that option accordingly:
package: individually: true excludeDevDependencies: false
You can use the
exclude global, and per-function, configurations and it will include/exclude the especified files/patterns.
BENCHMARK.md - auto generated.