Skip to content

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

@Primajin

Description

@Primajin

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: codemodSpecific to codemod.ready to takeHelp wanted. Guidance available. There is a high chance the change will be acceptedtype: new featureExpand the scope of the product to solve a new problem.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions