React-dates: What is the payload size of react-dates and its dependencies?

Created on 6 Oct 2017  Â·  2Comments  Â·  Source: airbnb/react-dates

This would be valuable info to know when deciding whether or not to integrate this component.

Most helpful comment

We will also be digging into ways to minimize the size very soon. Specifically for something like the DateRangePicker, even when the DayPicker is not visible, it will still be loaded. There are some improvements we could do in those spheres that we will be working on for our benefit. :)

If you do care about this, we do recommend deep-importing only the packages you need, ie.

import DateRangePicker from 'react-dates/lib/components/DateRangePicker`;

over using the main entry point like below

import { DateRangePicker } from 'react-dates';

Both work, but the latter is a bit easier while the former is able to made more performant depending on your build.

All 2 comments

The only payload size that matters is post-minification and post-gzip, and that depends on your app's settings… typically you'd have a process of determining your app's bundle size diffs on a PR prior to merging to master.

Additionally, if you import the main entry point, you'll get the entire package, but if you deep-import only the components you need, you'll have less code (ie, manually tree-shaking, which is always a best practice). This means there's no generic answer unless we provide a table of every entry point, and its size, and even then the size won't be generic due to the above paragraph.

We will also be digging into ways to minimize the size very soon. Specifically for something like the DateRangePicker, even when the DayPicker is not visible, it will still be loaded. There are some improvements we could do in those spheres that we will be working on for our benefit. :)

If you do care about this, we do recommend deep-importing only the packages you need, ie.

import DateRangePicker from 'react-dates/lib/components/DateRangePicker`;

over using the main entry point like below

import { DateRangePicker } from 'react-dates';

Both work, but the latter is a bit easier while the former is able to made more performant depending on your build.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wub picture wub  Â·  20Comments

rodryquintero picture rodryquintero  Â·  70Comments

Jucesr picture Jucesr  Â·  19Comments

isi-gach picture isi-gach  Â·  21Comments

nkint picture nkint  Â·  21Comments