optimizePackageImports
일부 패키지는 수백 또는 수천 개의 모듈을 내보낼 수 있으며, 이는 개발 및 프로덕션에서 성능 문제를 일으킬 수 있습니다.
experimental.optimizePackageImports에 패키지를 추가하면, 실제로 사용하는 모듈만 로드하면서도 많은 이름으로 내보낸 모듈들을 가져오는 편리함을 제공합니다.
next.config.js
module.exports = {
experimental: {
optimizePackageImports: ['package-name'],
},
}다음 라이브러리는 기본적으로 최적화됩니다:
lucide-reactdate-fnslodash-esramdaantdreact-bootstrapahooks@ant-design/icons@headlessui/react@headlessui-float/react@heroicons/react/20/solid@heroicons/react/24/solid@heroicons/react/24/outline@visx/visx@tremor/reactrxjs@mui/material@mui/icons-materialrechartsreact-use@material-ui/core@material-ui/icons@tabler/icons-reactmui-corereact-icons/*