Next.js · Senior · Question 16 of 75

What does optimizePackageImports do?

Explanation

Importing import { Icon } from 'big-icon-lib' through a barrel file can pull in hundreds of modules and slow down the build and the dev server. The option rewrites imports to the specific modules. For some popular libraries Next.js does this automatically.

Further reading

Problem with a question

Next.js · Senior · question 16

Test yourself

Take the Next.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz