Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #8: Debloat Library #11

Closed
wants to merge 1 commit into from

Conversation

jcar787
Copy link
Contributor

@jcar787 jcar787 commented Oct 30, 2018

Using lodash.get, lodash.last and lodash.sortby instead of the whole loadash library.
Dist files:

  • iron-db.min.js - before: 75.2 kb | after: 23.6 kb
  • iron-db.js - before: 545 kb | after: 113 kb

Also added webpack-dev-server as a devDependency.
npm run serve should open a server and display the contents. Easier for testing.

…loadash library. Added webpack-dev-server as a devDependency. npm run serve should open a server. Easier for testing.
@jcar787 jcar787 mentioned this pull request Oct 30, 2018
@jcar787
Copy link
Contributor Author

jcar787 commented Oct 30, 2018

@guanzo
Copy link

guanzo commented Oct 30, 2018

It's easier to use lodash-es, which allows for tree shaking. Not sure if lodash-es would result in a smaller bundle than individual imports.

@jcar787
Copy link
Contributor Author

jcar787 commented Oct 30, 2018

Sadly is not gonna result in small bundle, it's gonna be pretty much the same as importing lodash entirely. That's why I prefer just importing the functions that were used already.

@gruns
Copy link
Owner

gruns commented Oct 31, 2018

It's easier to use lodash-es, which allows for tree shaking. Not sure if
lodash-es would result in a smaller bundle than individual imports.

Turns out, lodash-es indeed results in a smaller bundle than both lodash
(duh) and lodash.get + lodash.last + lodash.sortby.

Results of npm run build with

  • lodash: 76986 byte iron-db.min.js
  • lodash.get, lodash.last, and lodash.sortby: 24161 byte iron-db.min.js
  • lodash-es: 23753 byte iron-db.min.js

Winner: lodash-es. I switched to such in 974402a.

Huge thank you for your PR and input, @jcar787 and @guanzo. Don't hesitate to
let me know if there's anything else I can do for you.

@gruns gruns closed this Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants