adobe / adobe/aio-sdk

Evaluate lib size for all packages used in serverless

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15
Forks
7
PR merge metrics
No merged PRs in 30d

Description

In making the aio-lib-env library work with webpack and serverless actions I noticed some size issues.
This is not a reflection of aio-lib-env, just the way npm packages work ...
aio-lib-env is used as an example because it is probably our smallest module, 74 LOC including license header
BundlePhobia reports it has a minified size of 348.4 kB [1]

# Adding to an action

### a simple action with a dependency on node-fetch and nothing else:

du -sh dist/actions/list-temp
384K dist/actions/list-temp
du -sh dist/actions/list.zip
180K dist/actions/list.zip

### add + build
`const { getCliEnv, DEFAULT_ENV } = require('@adobe/aio-lib-env')` and `console.log('getCliEnv => ', getCliEnv())`

du -sh dist/actions/list-temp
1.3M dist/actions/list-temp
du -sh dist/actions/list.zip
388K dist/actions/list.zip

Most of this is probably the logging lib, which includes winston, ... but the simple fact that this lib is so small really shows the point.

### An action that uses aio-sdk only

`const { Core } = require('@adobe/aio-sdk')`

du -sh dist/actions/list-temp
6.5M dist/actions/list-temp
du -sh dist/actions/list.zip
1.4M dist/actions/list.zip

### Adding back @adobe/aio-lib-env has no effect if @adobe/aio-sdk is already there ...

du -sh dist/actions/list-temp
6.5M dist/actions/list-temp
du -sh dist/actions/list.zip
1.4M dist/actions/list.zip

[ 1 : bundlephobia aio-lib-env](https://bundlephobia.com/result?p=@adobe/aio-lib-env@1.0.0)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the recorded du measurements for the simple node-fetch action, the aio-lib-env action, and the @adobe/aio-sdk-only action. Compare the resulting temporary and zipped sizes and identify the package dependencies contributing to the increase; done means documenting the size impact for the packages used in serverless actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.