Skip to content

Instantly share code, notes, and snippets.

@ajhsu
Created December 5, 2018 07:21
Show Gist options
  • Save ajhsu/1f3a8de0d2be4289ad95f4c3ebebeb4d to your computer and use it in GitHub Desktop.
Save ajhsu/1f3a8de0d2be4289ad95f4c3ebebeb4d to your computer and use it in GitHub Desktop.
Bundled file size comparison when you only need debounce and throttle from Lodash.

Metrics

Without lodash
-rw-r--r--  1 ajhsu  staff    96K 12  5 14:41 app.bundle.js

Bundled with independent lodash.debounce && lodash.throttle package
-rw-r--r--  1 ajhsu  staff   106K 12  5 14:58 app.bundle.js

Bundled with `import lodash from 'lodash/function'`
-rw-r--r--  1 ajhsu  staff   141K 12  5 14:49 app.bundle.js

Bundled with `import { debounce, throttle } from 'lodash-es'`
-rw-r--r--  1 ajhsu  staff   381K 12  5 15:11 app.bundle.js

Bundled with `import lodash from 'lodash'`
-rw-r--r--  1 ajhsu  staff   172K 12  5 14:44 app.bundle.js

Not sure if I'm doing this wrong, bundling lodash-es seems to have larger file size than bundling the entire lodash package directly.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment