-
Notifications
You must be signed in to change notification settings - Fork 403
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
Custom lodash update #75
Conversation
Would we instead be able to only require the pieces we need (for example, `require('lodash/isArray')` instead of having to include a custom Lodash build?
|
That's a good point, and that's entirely up to you — doing it that way will increase flexibility and ease development, but it would add slightly more size to the build. I was trying to make the browser build as tiny as possible by removing as much extra lodash stuff as possible |
Interesting—how will that increase the size of the build? I would expect the build sizes to be equivalent.
|
I tried using various `require`s, and I expected it to be the same, but it
actually increases the file size from 144kb to 277kb. I suspect it's
because it just uses the un-minified lodash, which comes with lots of
comments. With gzip this is probably makes a negligible difference, though.
Another side effect of using various `require`s forces the source code to
be changed — I prefer just using regular lodash syntax `_.isArray` instead
of redefining an `isArray` — whatever additional lodash functionality you
need you can just regenerate.
In my humble opinion, I'd still prefer the custom lodash solution for
generation a slightly smaller airtable browser library
cheers!
…On Mon, Nov 26, 2018 at 4:15 PM Evan Hahn ***@***.***> wrote:
Interesting—how will that increase the size of the build? I would expect
the build sizes to be equivalent.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADsHaCIVn2goAic09bWaWy6OisEyriKVks5uzFoCgaJpZM4Yz0hh>
.
|
…al (#76) The minified size went from 216 KB to 122 KB. Did three things: 1. Instead of _.isArray, we use things like var isArray = require('lodash/isArray') 2. Removed the async package; we weren't using it for much 3. Replaced some of Lodash's methods with native methods (like _.isUndefined(x) with x === void 0. See #75.
I'm going to close this issue because we'll soon release a version that lowers the minified size to 122 KB. Thanks for bringing this to our attention—we'll update you when we release the new version. |
Exciting! thanks for all your hard work
…On Nov 28, 2018, 2:57 PM -0500, Evan Hahn ***@***.***>, wrote:
I'm going to close this issue because we'll soon release a version that lowers the minified size to 122 KB. Thanks for bringing this to our attention—we'll update you when we release the new version.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
We just released |
Awesome!! Great work, guys!
…On Nov 29, 2018, 2:35 PM -0500, Evan Hahn ***@***.***>, wrote:
We just released ***@***.*** which shrinks the minified size by almost half. Thanks for bringing this up with us!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hey there, I removed
lodash
as a requirement frompackage.json
and included a custom lodash file inother/lodash.min.js
. The generator command is in a line in package.json calledgenlodash
in case it needs to be appended.I also added a new grunt command to build a browserified version, and regenerated the
airtable.browser.js
build. It's a lot smaller now (from 646kb to 144kb)!