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
Import from react-datepicker duplicates date-fns modules #2769
Comments
This comment has been minimized.
This comment has been minimized.
@tu4mo these are different issues. |
@alexandrchebotar Oh, sorry. Was looking at the wrong thing. |
@alexandrchebotar have you found a temporary workaround to force the use of a common date-fns module? |
I hope that this issue will be resolved in near future |
I think rc-picker uses star import for all locales of date-fns so this leads to growing bundle size |
Any updates on this? |
Looking through date-fns/date-fns#2207 and verifying that treeshaking should work in my project, I think the "duplication" mentioned here is just because Refer to the date_utils.js file where 57 functions are imported, used and re-exported in some way to be used elsewhere. |
Describe the bug
Because of direct import from
date-fns/[module]
when you importreact-datepicker
with es6 import you add that modules to bundle.Same time if you import something from
date-fns
or other library that usesdate-fns
, for exampledate-fns-tz
, you add to bundle modules fromdate-fns/esm
. As a result you duplicate somedate-fns
modules.To Reproduce
Steps to reproduce the behavior:
react-datepicker
:date-fns
:Expected behavior
import DatePicker from "react-datepicker"
should add modules fromdate-fns/esm/
Screenshots
Additional context
React Date Picker version - 3.6.0.
The text was updated successfully, but these errors were encountered: