Skip to content

Codemods not working when using re-exports #45663

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

Open
Brodzko opened this issue Mar 24, 2025 · 0 comments · May be fixed by #45977
Open

Codemods not working when using re-exports #45663

Brodzko opened this issue Mar 24, 2025 · 0 comments · May be fixed by #45977
Assignees
Labels
new feature New feature or request package: codemod Specific to @mui/codemod

Comments

@Brodzko
Copy link

Brodzko commented Mar 24, 2025

Summary

Hey!

In our codebase, we use MUI packages as re-exports from our own custom package, i.e. we have a package called @org/ui from which we export a /material path that contains

export * from '@mui/material';

This means that in our codebase, all components are imported as they normally would, except the name of the package is different. So instead of

import { Typography } from '@mui/material'

we do

import { Typography } from '@org/ui/material'

I just ran into an issue trying to use codemods to migrate to v6 where the codemods will never execute correctly since they match files based on

root
    .find(j.ImportDeclaration, (decl) => decl.source.value.includes('@mui'))

I realize this is a niche use-case but would greatly appreciate if we could e.g. provide a custom identifier to the code mods? An alternative for us is to always fork the codemods package I suppose.

Many thanks for consideration! 🙏

Examples

No response

Motivation

No response

Search keywords: codemod

@Brodzko Brodzko added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 24, 2025
@DiegoAndai DiegoAndai moved this to Backlog in Material UI Mar 24, 2025
@zannager zannager added the package: codemod Specific to @mui/codemod label Mar 24, 2025
@siriwatknp siriwatknp linked a pull request Apr 22, 2025 that will close this issue
1 task
@siriwatknp siriwatknp added new feature New feature or request and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request package: codemod Specific to @mui/codemod
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants