[DatePicker] Use only path imports from @material-ui/core
See original GitHub issueMaterial-UI forbid imports over two levels as it can lead to duplication in people bundles. Meaning, if somebody does:
import { Modal } from '@material-ui/core'; // 1.
import TrapFocus from '@material-ui/core/Modal/TrapFocus'; // 2.
It will bundle 1. and 2.:
- https://unpkg.com/browse/@material-ui/core@4.9.10/esm/Modal/TrapFocus.js
- https://unpkg.com/browse/@material-ui/core@4.9.10/Modal/TrapFocus.js
Now, given we do:
in the codebase, we very likely cause this double bundling quite often. For instance:
import { Dialog } from '@material-ui/core';
import { DateRangePicker } from '@material-ui/pickers';
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (20 by maintainers)
Top Results From Across the Web
[DatePicker] Use only path imports from @material-ui/core
P.S. I'd like not use @material-ui/core/Button imports because of typescript autoimport. I am not writing imports manually at all.
Read more >material ui lab date picker, Can't resolve ... - Stack Overflow
I went into the node_modules to look for the specific files: The location of the imports was not accurate so I changed them...
Read more >Migration from @material-ui/pickers - MUI
If you are going to upgrade, the easiest way might be to go through each picker usage in ... -import { DatePicker }...
Read more >DatePicker - @material-ui/pickers component
DatePicker usage examples and API of @material-ui/pickers. ... component uses a @media (pointer: fine) media query to determine which version to use.
Read more >13 React DatePickers and TimePickers for 2020
Choose and use useful React date-picker components! ... platform also lets you import the component's code to customize it locally.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dmtrKovalenko
@material-ui/core/Modal/TrapFocus.js
and@material-ui/core/esm/Modal/TrapFocus.js
is not the same file😱(Has it been that long?!)
Done.