-
Notifications
You must be signed in to change notification settings - Fork 103
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
Make the distribution file smaller #212
Comments
Considering that Personally I wouldn't be dropping |
Do we get significant savings if we change all usages of e.g. // not this
const _ = require('lodash');
// _.mergeWith
// this
const mergeWith = require('lodash/mergeWith'); |
@JosephClay this might sound weird, but const _ = require('lodash'); generates smaller distributive files than the const mergeWith = require('lodash/mergeWith'); AFAIK the magic is cast by this line: Line 35 in 9bd809b
|
|
@JosephClay Yea unfortunately lodash is not ready for real tree shaking yet, so it has to be hacked through that babel plugin.
Um so stamp-specification would be just written manual how to do it? I hope that stamp-utils don't become dependency of stampit, that sounds kinda weird to me. |
That would be ideal. But sounds complicated. :) |
I am confused now, what would be complicated? There is already written manual of specification. By removing functional code from there makes it "written manual of how to do it". I meant more like that making |
There is already a "manual": https://medium.com/@koresar/fun-with-stamps-episode-4-implementing-stamps-in-30-loc-e52f5c17dcfe
Yes. |
|
I thought it was interesting to have different people working from the spec writing independent stamp implementations just to test the spec and make sure the core team understood it well enough to write compatible implementations, but I don't care whether or not we actually keep a bunch of independent implementations of the spec going forward. We're all busy people. Let's do the simplest thing that works. =) |
Oh, yeah! Btw, I already found problems in the |
Alright, fair enough. Anyway that got bit side tracked here from main issue of size, but that needs to be tackled mainly in stamp-specification / stamp-utils first. |
Removed lodash, polyfills, unused helper methods, etc. Now the minified stampit is 5.7K
Lodash.
I'm pretty happy with 44->5.7 KB file size improvement. :) Let me know what you think. https://github.com/stampit-org/stampit/tree/v3_0 I'd like to thank @FredyC for doing all that rollup initial work. Very helpful! |
I'm wasting too much time on that babel, lodash, ES6, etc. This pushes me to the conclusion that using ES6 for stampit is a bad idea. I'm tempting to rewrite stampit v3 using ES5. P.S. |
I am sorry you had to go through with that, I could have helped me as I have much more experience with build systems and how it works. I see you got rid of |
Which exactly utility functions? |
Those you created instead of using lodash, but I guess that depends on if I can convince you of getting |
|
Ok I see, that makes sense. 👍 |
I am thinking if it's actually necessary to place code for all these functions to the root. I placed the |
@FredyC true. My bad. Will fix that. Thanks |
Talked with @FredyC in the gitter chat. As the result build system:
|
Closing this as Done. |
stampit v2 full minified is 13K.
The stampit v3 full minified is 44K.
We are using
_.mergeWith
. But stampit v2 uses lodash v3, and stampit v3 uses lodash v4.Looks like lodash v4 is a bulky thing unlike lodash v3.
I've taken a look at the lodash implementation of the
_.mergeWith
. It does a lot of extra checks which in our case is not really necessary. We should do the following:stamp-specification
dependency from stampit._.mergeWith
implementation (e.g. lodash v3, orlodash.mergewith
module, or some other thing).lodash
dependency altogether. Not sure about that one though.P.S. Could be babel-polyfil fault too. :)
The text was updated successfully, but these errors were encountered: