c5453453ac
This PR improves the [Modularize Imports](https://nextjs.org/docs/advanced-features/compiler#modularize-imports) section of Next.js Compiler docs as well as [the `modularize-imports` example](https://github.com/vercel/next.js/tree/canary/examples/modularize-imports). They were originally added in [this PR](https://github.com/vercel/next.js/pull/34969). - Link to [the `modularize-imports` example](https://github.com/vercel/next.js/tree/canary/examples/modularize-imports) was missing from the docs. - Clarified some explanations and reorganized the content so it's easier to understand. - Added docs for `skipDefaultConversion`. - Added docs for `preventFullImport`. - Illustrated how to use `kebabCase` and `skipDefaultConversion` on the [the `modularize-imports` example](https://github.com/vercel/next.js/tree/canary/examples/modularize-imports). ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
21 lines
563 B
JavaScript
21 lines
563 B
JavaScript
// @ts-check
|
|
|
|
/**
|
|
* @type {import('next').NextConfig}
|
|
**/
|
|
const nextConfig = {
|
|
modularizeImports: {
|
|
'../components/halves': {
|
|
transform: '../components/halves/{{ member }}',
|
|
},
|
|
'../components/ui': {
|
|
// Use `kebabCase` helper to convert `HeadingLarge` to `heading-large`
|
|
transform: '../components/ui/{{ kebabCase member }}',
|
|
// Use `skipDefaultConversion`, since `HeadingLarge` is exported
|
|
// using named exports instead of default exports
|
|
skipDefaultConversion: true,
|
|
},
|
|
},
|
|
}
|
|
|
|
module.exports = nextConfig
|