---
title: optimizePackageImports
description: API Reference for optmizedPackageImports Next.js Config Option
url: "https://nextjs.org/docs/14/app/api-reference/next-config-js/optimizePackageImports"
version: 14.2.35
lastUpdated: 2024-01-21
prerequisites:
  - "API Reference: /docs/14/app/api-reference"
  - "next.config.js Options: /docs/14/app/api-reference/next-config-js"
---


Some packages can export hundreds or thousands of modules, which can cause performance issues in development and production.

Adding a package to `experimental.optimizePackageImports` will only load the modules you are actually using, while still giving you the convenience of writing import statements with many named exports.

```js filename="next.config.js"
module.exports = {
  experimental: {
    optimizePackageImports: ['package-name'],
  },
}
```

Libraries like `@mui/icons-material`, `@mui/material`, `date-fns`, `lodash`, `lodash-es`, `react-bootstrap`, `@headlessui/react`, `@heroicons/react`, and `lucide-react` are already optimized by default.
---

For an index of all available documentation, see [/docs/14/llms.txt](/docs/14/llms.txt)