Skip to content
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

Support for nested imports? #1934

Closed
aamirafridi opened this issue Jun 24, 2020 · 5 comments
Closed

Support for nested imports? #1934

aamirafridi opened this issue Jun 24, 2020 · 5 comments

Comments

@aamirafridi
Copy link
Contributor

Using the Import like this for treeshaking

import {
  DesktopDateRangePicker,
  MobileDateRangePicker,
} from "@material-ui/pickers/DateRangePicker/DateRangePicker";

No TS error but JS errored Cannot find module '@material-ui/pickers/DateRangePicker/DateRangePicker'

@aamirafridi
Copy link
Contributor Author

I know that this works

import {
  DesktopDateRangePicker,
  MobileDateRangePicker,
} from "@material-ui/pickers";

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 24, 2020

@aamirafridi We don't support nested imports for the pickers repository. We might with mui/material-ui#19706. I think that the correct solution would be:

import DateRangePicker, {
  DesktopDateRangePicker,
  MobileDateRangePicker,
} from "@material-ui/pickers/DateRangePicker";

The incentive so far for supporting it is that tree-shaking doesn't work in development, which can harm the DX.

@aamirafridi
Copy link
Contributor Author

Ok thanks :)

@oliviertassinari
Copy link
Member

Keeping it open to signal that it's not fixed and incentive for more comments.

@oliviertassinari oliviertassinari changed the title No Typescript error but JS errored Support for nested imports? Jun 24, 2020
@oliviertassinari oliviertassinari changed the title Support for nested imports? Support for nested imports? Jun 24, 2020
@oliviertassinari
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants