-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[docs][pickers] Document the bundle size impact of the various adapters #5076
Comments
Hi Thanks for your report |
AdapterDateFns
bundles the whole date-fns
library (no tree shaking)
Hi @flaviendelangle!,
and the result of
Thanks! |
Did you try migrating from the lab to our new package ? I'll try to have a look |
@flaviendelangle I just tried it and the tree shaking still not working properly |
I think the problem is directly in The diff of 262kb being close to what you get through |
Hey @flaviendelangle, any luck figuring out how to reduce the bundle of Thanks! |
Hey We did not have the time to focus on that aspect yet 😬 |
If I understand correctly, the problem is that it's hard to do tree-shaking on ES classes such as the date-io project uses. (date-io's purpose is to say, "Here's a standard date/time abstraction that you can pass to any third-party library you want, and date-io will support any method calls that third-party library wants." So it has to import every date-fns function that it might need to implement any of its API methods.) If I use |
If it only imports content that is being used on the adapter (even on method you are not using), then I agree that it is the expected behavior. Most of the code is in very common method (like I have the feeling the |
AdapterDateFns
bundles the whole date-fns
library (no tree shaking)
Feels wierd that the date-fns adapter is so much heavier than the dayjs one but the picker and grid is also heavy, so i created a new issue with cloneable repo |
Duplicates
Latest version
Current behavior 😯
I'm using
import AdapterDateFns from '@mui/lab/AdapterDateFns';
to make custom dateAdapter forLocalizationProvider
. After that, i try to build it with webpack on modeproduction
. The tree shaking not working for this libraryI took about 254 kb which too large
Expected behavior 🤔
The size should be lower than that
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
The text was updated successfully, but these errors were encountered: