react-component / picker

📅 All Date Pickers you need.
https://picker.react-component.now.sh/
MIT License
257 stars 296 forks source link

When using date-fns, all locales are imported #721

Open thomastvedt opened 6 months ago

thomastvedt commented 6 months ago

https://github.com/react-component/picker/blob/e3f8437ad9c8b280868864a56aaa722c129e354b/src/generate/dateFns.ts#L27

This will import all locales from date-fns, right? Even if only one or two locales are used, this will import all of them?

nayansinghal23 commented 5 months ago

@thomastvedt sir this will definitely import all the locales even if we are using just one or two. The drawback of this is that since all the locales are being imported unnecessarily, our bundle size will increase which can harm site's performance. Instead, we can do like this :- import { enUS, es, fr } from 'date-fns/locale';

thomastvedt commented 5 months ago

It would be great if rc-picker could support only loading locales that are used 👌🌸