Relative Content

Tag Archive for javascriptreactjsperformancewebpacknext.js

Icon Component with Dynamic SVG Imports vs Bundle Size next.js – v14.2.3

I am trying to create an Icon component in a Next.js application that imports SVGs dynamically without significantly increasing the bundle size. Despite using various methods such as require.context(), dynamic(), and await import(), I am encountering an issue where all SVGs are being imported, resulting in a large bundle size.

Icon Component with Dynamic SVG Imports vs Bundle Size

I am trying to create an Icon component in a Next.js application that imports SVGs dynamically without significantly increasing the bundle size. Despite using various methods such as require.context(), dynamic(), and await import(), I am encountering an issue where all SVGs are being imported, resulting in a large bundle size.