Nuxt/docs/3.api/3.utils/preload-components.md
2024-02-21 18:09:45 +01:00

955 B

title description links
preloadComponents Nuxt provides utilities to give you control over preloading components.
label icon to size
Source i-simple-icons-github https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/composables/preload.ts xs

Preloading components loads components that your page will need very soon, which you want to start loading early in rendering lifecycle. This ensures they are available earlier and are less likely to block the page's render, improving performance.

Use preloadComponents to manually preload individual components that have been registered globally in your Nuxt app. By default Nuxt registers these as async components. You must use the Pascal-cased version of the component name.

await preloadComponents('MyGlobalComponent')

await preloadComponents(['MyGlobalComponent1', 'MyGlobalComponent2'])

::note On server, preloadComponents will have no effect. ::