react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Bundle size, moment library

Open kkseven07 opened this issue 8 years ago • 3 comments

This library uses 'moment' which is half of my bundle size. What can I do? Im new to react and know little about dependencies.

kkseven07 avatar Feb 08 '18 14:02 kkseven07

If you use webpack to create your bundle, you can remove unused moment.js locales using context replacement plugin. This will decrease moment.js size by ~400KB.

Add something like this to your plugins option in webpack.config:

new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /ru/)

chun-baoluo avatar Mar 02 '18 06:03 chun-baoluo

Moment.js was removed in #1527, starting v2.0.0, this package doesn't use Moment anymore.

martijnrusschen avatar Nov 17 '18 13:11 martijnrusschen

I don't know where to put this but I'm using version 2.0.0 and this package still increase my bundle size from 8 KB to 147KB using webpack production build.

mrtrandinhvn avatar Jan 24 '19 09:01 mrtrandinhvn