https://github.com/sergioramos/serverless-plugin-tree-shake
Shake the dependency tree and only package files needed
https://github.com/sergioramos/serverless-plugin-tree-shake
bundling serverless serverless-plugin tree-shaking
Last synced: 7 months ago
JSON representation
Shake the dependency tree and only package files needed
- Host: GitHub
- URL: https://github.com/sergioramos/serverless-plugin-tree-shake
- Owner: sergioramos
- License: bsd-3-clause
- Created: 2020-05-26T13:47:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T20:02:14.000Z (about 3 years ago)
- Last Synced: 2024-12-27T05:46:45.734Z (over 1 year ago)
- Topics: bundling, serverless, serverless-plugin, tree-shaking
- Language: JavaScript
- Homepage:
- Size: 7 MB
- Stars: 24
- Watchers: 2
- Forks: 11
- Open Issues: 64
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# serverless-plugin-tree-shake
Shake the file dependency tree and only include files needed.
## install
```bash
yarn add --dev serverless-plugin-tree-shake
```
```bash
npm install --save-dev serverless-plugin-tree-shake
```
## usage
```yaml
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 `excludeDevDependencies` enabled):
```
$ 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
```
More details: [`BENCHMARK.md`](./BENCHMARK.md).
##### typescript support
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__`](./test/__fixtures__) that start with `ts-`.
##### individually
This plugins supports bundling functions `individually`. Just use that option accordingly:
```yaml
package:
individually: true
excludeDevDependencies: false
```
##### include and exclude
You can use the `include` and `exclude` global, and per-function, configurations and it will include/exclude the especified files/patterns.
## performance
Check out [`BENCHMARK.md`](./BENCHMARK.md) - auto generated.
## license
BSD-3-Clause