Skip to content

Codemods not working when using re-exports #45663

Closed
@Brodzko

Description

@Brodzko

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

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions