Closed maxaggedon closed 4 years ago
@maxaggedon oh okay but you can import directly from date-fns right? but I'm not sure it's supporting tree shaking
@keremciu yes I did that, I just wanted to raise attention about this because documentation suggests to use re-exported locales, and maybe it should instead suggest to import only the used ones from date-fns
like so :
import fr from "date-fns/locale/fr";
@maxaggedon yep, definitely it should be like that. I think there's no reason to export locales again. I'm thinking about removing them and just leave enUS
locale import for default then we can just say please use locale from date-fns
like you write in your comment
See https://github.com/date-fns/date-fns/blob/master/docs/webpack.md. It can be imported dynamically
[BUG] Bug Reproduce Steps
When importing locale like this
import { fr } from "react-date-range/dist/locale"
, we import every locale re-exported fromdate-fns
. In my case (fr locale), it added 77KB of unused files after gzip.[BUG] Expected behaviour
Import only the necessary one.
Environment
Package Version: 1.0.3