bringking/react-web-animation

Bulky build size with `lodash.isequal`?

SiqiTian-minted opened this issue · 5 comments

Hi, I was examining the output of npm run build:umd:min -- --display-modules, and found the lodash.isequal is incredibly large:

npm run build:umd:min -- --display-modules

> react-web-animation@0.1.2 build:umd:min /Users/siqitian/Desktop/react-web-animation
> cross-env NODE_ENV=production webpack src/index.js dist/react-web-animation.min.js "--display-modules"

Hash: cf2f4056f2768d51e2b0
Version: webpack 1.14.0
Time: 1685ms
                     Asset   Size  Chunks             Chunk Names
react-web-animation.min.js  25 kB       0  [emitted]  main
   [0] ./src/index.js 1.64 kB {0} [built]
   [2] ./src/animatable.js 4 kB {0} [built]
   [3] ./src/effect.js 7.77 kB {0} [built]
   [4] ./src/mixins/playable.js 4.01 kB {0} [built]
   [5] ./~/lodash.assign/index.js 16.7 kB {0} [built]
   [6] ./~/lodash.isequal/index.js 49.6 kB {0} [built]
   [7] ./src/animation.js 5.4 kB {0} [built]
   [8] ./src/animation_group.js 1.95 kB {0} [built]
   [9] ./src/animation_sequence.js 1.99 kB {0} [built]
  [10] (webpack)/buildin/module.js 251 bytes {0} [built]
    + 1 hidden modules

Would it sound like a good idea if we use lodash ^4.11.0 but import with:

import _isEqual from 'lodash/isEqual';

@SiqiTian-minted we are already only including the items from lodash we need. Namely, assign and isEqual. Unless, I am missing something, your proposed example is another way of doing the same thing

Yes, I agree. But it looks like the lodash.isequal standalone package is a custom build of lodash, not just isEqual. Individual lodash functions are usually <10 kb I think. I full build of lodash is about 49 kb. Looks like something wrong with the lodash.isequal package itself.

@bringking did not get a satisfactory response there, i will try use selective import and if that helps bringing down the size, will do a PR

t47io commented

can close