馃憢 Thanks so much for all your hard work on this awesome library!
It would be really helpful for applications where disk space is a constraint and a bundler isn't the most viable option (e.g. scripts for Electron apps) to be able to pull in individual packages for only the functions you need. For example, if you only needed to use distanceInWords(), you could run something like:
npm install @date-fns/distance-in-words
and only install the code needed for that one function. For a point of comparison, Lodash offers the option of per-method packages in addition to function-per-file-in-one package style date-fns uses already.
Let me know if there's any more information I could provide that'd be helpful!
@mnquintana Thanks for your kind words!
I like the idea but I have a concern: the people will start getting duplicated code because of dependencies using different versions, date-fns and @date-fns/distance-in-words, etc.
@jdalton could you please tell me what's your experience of having lodash.assign, lodash.clonedeep, etc. with lodash?
If I could do it again I wouldn't produce lodash.assign, lodash.clonedeep and others. It's a maintenance pain. Folks end up reaching for them thinking they'll get a smaller bundle but the fact is that plain old lodash or lodash-es + lodash-webpack-plugin or babel-plugin-lodash end up creating smaller bundles. If I could go back I'd focus folks on the primary modular package instead offering individual packages.
@jdalton good point, thanks!
@mnquintana I think it's out-of-scope to provide individual packages in order to reduce disk space. It would be great to have a dedicated tool for reducing package size but it's definitely that we can't focus on.
Most helpful comment
If I could do it again I wouldn't produce
lodash.assign,lodash.clonedeepand others. It's a maintenance pain. Folks end up reaching for them thinking they'll get a smaller bundle but the fact is that plain oldlodashorlodash-es+lodash-webpack-pluginorbabel-plugin-lodashend up creating smaller bundles. If I could go back I'd focus folks on the primary modular package instead offering individual packages.