Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thomastvedt opened this issue Jan 2, 2024 · 2 comments
Open

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

thomastvedt opened this issue Jan 2, 2024 · 2 comments

Comments

@thomastvedt
Copy link

import * as Locale from 'date-fns/locale';

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
Copy link

@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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants