You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or if you want to disable the dynamic icon fetching completely and only use icons from the [client bundle](#client-bundle), you can set `provider: 'none'`:
232
234
233
235
```ts
@@ -446,6 +448,51 @@ This will make requests to Iconify API every time the client requests an icon. W
446
448
447
449
For icons that you know you are going to use frequently, you can bundle them with your client bundle to avoid network requests.
448
450
451
+
#### Prefetch (Preload) Icons
452
+
453
+
If you want icons to be available on first render, use the client bundle as the prefetch mechanism:
454
+
455
+
```ts
456
+
exportdefaultdefineNuxtConfig({
457
+
modules: [
458
+
'@nuxt/icon',
459
+
],
460
+
icon: {
461
+
clientBundle: {
462
+
// Explicitly pre-bundle known icons
463
+
icons: ['uil:github', 'heroicons:home'],
464
+
// Keep disabled if you only want explicit entries
465
+
scan: false,
466
+
},
467
+
},
468
+
})
469
+
```
470
+
471
+
You can also enable static scanning to pre-bundle icons referenced literally in your source files:
472
+
473
+
```ts
474
+
exportdefaultdefineNuxtConfig({
475
+
modules: [
476
+
'@nuxt/icon',
477
+
],
478
+
icon: {
479
+
clientBundle: {
480
+
// Automatically includes statically-detected icon usages
481
+
scan: true,
482
+
// Keep explicit entries for dynamic icon names
483
+
icons: ['uil:github'],
484
+
},
485
+
},
486
+
})
487
+
```
488
+
489
+
If you want to disable runtime icon fetching entirely, see [Disabling Runtime Fetching](#disabling-runtime-fetching) for the `provider: 'none'` + client bundle pattern.
490
+
491
+
> [!TIP]
492
+
> Static scanning only detects literal icon names. See [Scan Components](#scan-components) for details and examples, and [Rendering Icons in Component Tests](#rendering-icons-in-component-tests) for test-environment setup.
0 commit comments