NEXTJS_MISSING_OPTIMIZE_PACKAGE_IMPORTS
optimizePackageImports improves compilation speed for packages that use barrel files or export many modules.Conformance is available on Enterprise plans
optimizePackageImports
is a feature added in Next 13.5 that improves compilation speed when importing packages that use barrel
exports and export many named exports. This replaces the modularizeImports
configuration option as it optimizes many of the most popular open source libraries automatically.
Barrel files make the process of exporting code from a package convenient by allowing all the code to be exported from a single file. This makes it easier to import any part of the package into your application. However, since they export a lot of code from the same file, importing these packages can cause tools to do additional work analyzing files that are unused in the application.
For further reading, see:
As of Next.js 14.2.3, this configuration option is still experimental. Check
the Next.js documentation for the latest information here:
optimizePackageImports
.
To fix this, you can add a modularizeImports
config to next.config.js
for
the package that uses barrel files. For example:
experimental: {
optimizePackageImports: ['geist/components'];
}
Was this helpful?