Skip to content

Add support for named imports #8

@jeron-diovis

Description

@jeron-diovis

Currently this plugin converts all module imports into defult ones.
But some libraries have modules with named exports instead of defaults.
For example, @radix-ui:

import { Button } from "@radix-ui/themes"

should be transformed into:

import { Button } from "@radix-ui/themes/dist/esm/components/button"

Would be great to have an option like namedImport: boolean for items in settings array.
So it would do smth like this:

// importSpecifierComponent
const importDeclaration = option.namedImport ? `{${local.name}}` : local.name
return `import ${importDeclaration} from "${finalComponentPath}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions