Skip to content
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

[Bug]: transformImport isn't working well #1521

Closed
JoseBuendiaDigio opened this issue Feb 5, 2024 · 3 comments
Closed

[Bug]: transformImport isn't working well #1521

JoseBuendiaDigio opened this issue Feb 5, 2024 · 3 comments
Labels
🐞 bug Something isn't working

Comments

@JoseBuendiaDigio
Copy link

Version

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 8.82 GB / 31.71 GB
  Browsers:
    Edge: Chromium (121.0.2277.98)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @rsbuild/core: 0.3.11 => 0.3.11
    @rsbuild/plugin-react: 0.3.11 => 0.3.11
    @rsbuild/plugin-type-check: 0.3.11 => 0.3.11

Details

I want to transform import { CssBaseline } from '@mui/material'; to import CssBaseline from '@mui/material/CssBaseline ';

My config is

{
                libraryName: '@mui/material',
}

And the output is

 import Typography from "@mui/material/lib/typography";

If I disable libraryDirectory the result is the same if I set libraryDirectory to '' the result is import Typography from "@mui/material//typography";

And if I try the customName customName: (member: string) => '@mui/material/${member}' the result is the same.

How can I transform it? I think that there is a bug.

Reproduce link

isnt necessary

Reproduce Steps

build or dev

@JoseBuendiaDigio JoseBuendiaDigio added the 🐞 bug Something isn't working label Feb 5, 2024
@xc2
Copy link
Collaborator

xc2 commented Feb 6, 2024

instead of function, please use string template like customName: '@mui/materials/{{ member }}'

ref: https://rsbuild.dev/config/source/transform-import#customname

btw, import Typography from "@mui/material//typography" would work i think

@JoseBuendiaDigio
Copy link
Author

This works, but the other no. This maybe confusing.

image

@chenjiahan
Copy link
Member

This is not a valid import path:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants