icon icon indicating copy to clipboard operation
icon copied to clipboard

Significant Build Size Increase with @nuxt/icon and Deprecation Warnings from @iconify

Open michaelreinhard1 opened this issue 1 year ago • 2 comments

After integrating @nuxt/icon into my project, I noticed a significant increase in the build size from approximately 2MB to 14MB. This issue persists even though I am not using any <Icon /> elements in my components. Additionally, I am encountering numerous deprecation warnings related to @iconify.

It appears that @nuxt/icon is downloading all icon collections instead of only the icons being used, leading to the substantial increase in build size.

Screenshot_1

Before adding @nuxt/icon

image (3)

After adding @nuxt/icon, @iconify-json/heroicons and @iconify-json/tabler

image (2)

The build size should not increase significantly, especially when no <Icon /> elements are used.

If relevant, here are the versions I am using:

Nuxt Version: 3.12.3
@nuxt/icon Version: ^1.0.0
@iconify-json/heroicons: ^1.1.21
@iconify-json/tabler: ^1.1.116
Node.js Version: v20.13.1

A ton of deprecation warnings like these (node:23176) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at ...\node_modules\@iconify\vue\package.json imported from ...\node_modules\nuxt-og-image\dist\node_modules\_index.js.

Thank you in advance for your help in fixing this issue! :)

michaelreinhard1 avatar Jul 05 '24 09:07 michaelreinhard1

Related #184.

ExEr7um avatar Jul 05 '24 19:07 ExEr7um

Try setting serverBundle: false in the configuration. This will prevent loading the collections used by nuxt-dev-kit.

mobycache avatar Jul 07 '24 17:07 mobycache