How to disable prefetching dynamic imports in Next.js?

Viewed 1039

I'm using Next.js dynamic component to lazy load some of my components to reduce the initial bundle size. https://nextjs.org/docs/advanced-features/dynamic-import

It's pretty similar to React lazy and suspense.

The thing is that Next.js adds a preload element for every dynamic component. For example:

<link rel="preload" href="/_next/static/chunks/fb85da93314b56687ab65338660b69e70b8ab984.e94f6814b2bcf36d403a.js" as="script">

The problem is that it triggers too many requests and affects my web vitals score. Is there any way to disable it or control its timing?

0 Answers
Related