网页 综合 更新时间 2026-11-16 04:29:46

@nuxt/icon · Nuxt Modules

自动蜘蛛 nuxt.com 正文约 2109 字
@nuxt/icon · Nuxt Modules
Run the following command to add the module to your project, with the nuxt add command:
That's it, you can now use the <Icon /> in your components, see Usage.
✨ If you are using VS Code, you can use the Iconify IntelliSense extension by @antfu
You can install the module manually with:
Update your nuxt.config.ts
If you have the legacy module nuxt-icon installed, you might want to remove it from the modules list.
If you are building a plain Vue app with Vite (for example when using Nuxt UI's Vue integration), there is no Nuxt server to serve icons from, and @iconify/vue would fetch icons from the Iconify API at runtime. To render icons offline without network requests, @nuxt/icon ships a standalone Vite plugin that pre-bundles the icons you use into the client build.
Install it with @iconify/vue, which the registration module imports, and the icon collections you use:
Then add the plugin to your Vite config:
Then register the bundled icons once in your entry file:
Add the type shims for the virtual modules to the types of your tsconfig.json, next to the ones you already list:
The plugin accepts the same options as icon.clientBundle (icons, scan, sizeLimitKb), plus customCollections — with two differences in defaults: scan is enabled by default (bundling is the whole point of the plugin), and includeCustomCollections is always enabled by default (there is no server provider to fall back to).
For library and framework authors integrating icons themselves: virtual:nuxt-icon-bundle exports init(addIcon) so you can register the bundled data on your own copy of @iconify/vue (or any compatible store), and the underlying primitives (IconUsageScanner, resolveBundleIcons, generateClientBundleCode, ...) are exported from @nuxt/icon/utils.
For server-side rendering, @iconify/vue has its own requirements: see its documentation.
See playgrounds/vite/ for a working example (pnpm play:vite to run it locally).
Render any of the 200,000+ Iconify icons, or your own Vue components.
Stay updated on new releases and features, guides, and community updates.
Copyright © 2016-2026 Nuxt - MIT License
访问原文 返回搜索 https://nuxt.com/modules/icon
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。