Transform the import path, which can be used to modularly import the subpath of third-party packages. The functionality is similar to babel-plugin-import。
When the Ant Design component library <= 4.x version is installed in the project, Modern.js will automatically add the following default configurations:
When the Arco Design component library is installed in the project, Modern.js will automatically add the following default configurations:
When you add configurations for antd
or @arco-design/web-react
, the priority will be higher than the default configurations mentioned above.
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to Rsbuild - source.transformImport.
You can manually set transformImport: false
to disable the default config.
You can also use the function usage of transformImport
to modify the default configuration.
For example, if you use externals
to avoid bundling antd, because transformImport
will convert the imported path of antd by default, the matching path changes and externals cannot take effect. At this time, you can disable transformImport
to avoid this problem.