pond icon indicating copy to clipboard operation
pond copied to clipboard

Better dependencies management

Open NN--- opened this issue 8 years ago • 2 comments

Please don't import everything like:

import * as _ from "lodash";
import * as Immutable from "immutable";

Instead import what you exactly need in the file. It will reduce size of the bundle.

NN--- avatar Jul 16 '17 18:07 NN---

While I agree with this in principle, in practice I don't think this is so straightforward

Firstly, being more specific with immutable.js seems kind of pointless right now. Importing only say SortedSet saves just 1k. See this issue for a discussion of why: https://github.com/facebook/immutable-js/issues/1190

Secondly, the future typescript version of this code imports moment-timezone, with timezone information included, and currently the size of that dependency greatly overwhelms either lodash or immutable. It also imports locales for moment, regardless, which it might be possible to remove with webpack, but still that's probably 75% of moment's size. Being specific with moment does not help at all.

Lodash could be more specific using sub modules and make some marginal differences.

I'm keeping this open as a general task to reduce sizes, but I don't think it's so simple.

pjm17971 avatar Aug 18 '17 16:08 pjm17971

Late to the party here, going through a massive bundle diet currently...

screen shot 2018-04-25 at 9 13 18 am

It looks like you're including momentjs in the bundle, shouldn't this be a peer-dependency? Leaving control of the moment-timezone imports to the user would allow us to import the locales we need and also keep pondjs core size down. I think moving momentjs to a dependency would make this easier (maybe this has already been on versions > 0.8?)

camflan avatar Apr 25 '18 14:04 camflan