question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[DatePicker] Use only path imports from @material-ui/core

See original GitHub issue

Material-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.:

  1. https://unpkg.com/browse/@material-ui/core@4.9.10/esm/Modal/TrapFocus.js
  2. https://unpkg.com/browse/@material-ui/core@4.9.10/Modal/TrapFocus.js

Now, given we do:

https://github.com/mui-org/material-ui-pickers/blob/7bed283699ef768936a3ec7c5dc89571492dddd4/lib/src/wrappers/DesktopPopperWrapper.tsx#L6

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:closed
  • Created 3 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
TrySoundcommented, Apr 14, 2020

@dmtrKovalenko @material-ui/core/Modal/TrapFocus.js and @material-ui/core/esm/Modal/TrapFocus.js is not the same file

1reaction
mbrookescommented, Apr 23, 2020

image

😱(Has it been that long?!)

Could you extend the number of people that have the publish rights

Done.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found