mui / material-ui

Materialย UI: Ready-to-use foundational React components, free forever. It includes Material UI, which implements Google's Material Design.
https://mui.com/material-ui/
MIT License
92.45k stars 31.85k forks source link

[codemod] Codemod for using path-imports (reverse top-level-imports codemod) #37903

Open Primajin opened 12 months ago

Primajin commented 12 months ago

Duplicates

Latest version

Summary ๐Ÿ’ก

I would like to request a reverse version of the top-level-imports codemod.

Given https://mui.com/material-ui/guides/minimizing-bundle-size/#option-one-use-path-imports Path Level Imports is the easiest solution when dealing with slowness but especially when using CRA it can be very hard to configure top-level-imports to run smoothly.

Examples ๐ŸŒˆ

https://github.com/mui/material-ui/blob/master/packages/mui-codemod/src/v5.0.0/top-level-imports.js but in reverse

Screenshot 2023-07-10 at 17 06 53

Motivation ๐Ÿ”ฆ

I am experiencing slow tests and startup times and I was following the documentation here: https://mui.com/material-ui/guides/minimizing-bundle-size/#option-two-use-a-babel-plugin. However when adding the necessary steps tests will fail because of other third party modules that use Material and are incompatible with the change.

I would like to try out if turning back from top-level-imports to path-imports will solve our issues but in order to see the results I would need to manually rewrite a ton of code, and a codemod would be very helpful instead.

ZeeshanTamboli commented 10 months ago

The feature is valid. @Primajin Just curious, do you still need it?

Primajin commented 10 months ago

Yes that would still be nice ๐Ÿ™๐Ÿป

Primajin commented 9 months ago

@ZeeshanTamboli Is there a roadmap / planning for this by any chance? Could this be prioritized given we are Premium Subscribers ๐Ÿ˜ ?

๐Ÿ’ณ 72801 ๐Ÿ™๐Ÿป

ZeeshanTamboli commented 9 months ago

@Primajin, there's no official roadmap for this. It would be great if you could give it a try on your own.

cruessler commented 6 months ago

Iโ€™m facing the same issue and want to try to create a PR, but I canโ€™t make any promises with respect to a timeline at this point. ๐Ÿ˜„