If you have feedback about `swcMinify`, please share it on the [feedback discussion](https://github.com/vercel/next.js/discussions/30237).
If you have feedback about `swcMinify`, please share it on the [feedback discussion](https://github.com/vercel/next.js/discussions/30237).
### Modularize Imports
Allows to modularize imports, similar to [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports).
Transforms member style imports:
```js
import{Row,GridasMyGrid}from'react-bootstrap'
import{merge}from'lodash'
```
...into default style imports:
```js
importRowfrom'react-bootstrap/lib/Row'
importMyGridfrom'react-bootstrap/lib/Grid'
importmergefrom'lodash/merge'
```
Config for the above transform:
```js
// next.config.js
module.exports={
experimental:{
modularizeImports:{
'react-bootstrap':{
transform:'react-bootstrap/lib/{{member}}',
},
lodash:{
transform:'lodash/{{member}}',
},
},
},
}
```
Advanced transformations:
- Using regular expressions
Similar to `babel-plugin-transform-imports`, but the transform is templated with [handlebars](https://docs.rs/handlebars) and regular expressions are in Rust [regex](https://docs.rs/regex/latest/regex/) crate's syntax.
This transform uses [handlebars](https://docs.rs/handlebars) to template the replacement import path in the `transform` field. These variables and helper functions are available:
1.`matches`: Has type `string[]`. All groups matched by the regular expression. `matches.[0]` is the full match.
2.`member`: Has type `string`. The name of the member import.
3.`lowerCase`, `upperCase`, `camelCase`: Helper functions to convert a string to lower, upper or camel cases.
## Unsupported Features
## Unsupported Features
When your application has a `.babelrc` file, Next.js will automatically fall back to using Babel for transforming individual files. This ensures backwards compatibility with existing applications that leverage custom Babel plugins.
When your application has a `.babelrc` file, Next.js will automatically fall back to using Babel for transforming individual files. This ensures backwards compatibility with existing applications that leverage custom Babel plugins.
This example shows how to use the `modularizeImports` config option.
## Preview
Preview the example live on [StackBlitz](http://stackblitz.com/):
[](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/modularize-imports)
## Deploy your own
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example):
[](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/modularize-imports&project-name=modularize-imports&repository-name=modularize-imports)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example)([Documentation](https://nextjs.org/docs/deployment)).