Next.js Discord

Discord Forum

next/dynamic not affecting lighthouse script.size

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
Hello

I have a server component that render pages from my CMS (payload)

This component basically loops over an array of components and render a different component depending on the type (if (type === "accordion") { ... })

Now I added some new components and this caused resource-summary.script.size in lighthouse to increase, even when I didn't actually used the new component.

I tried lazy loading them like this:

const AccordionBlockRender = dynamic(() =>
  import("./Accordion").then((mod) => mod.AccordionBlockRender),
);


but it didn't change anything. Is this now next/dynamic should be used?

0 Replies