How do I set a default provider when using the nuxt image module?
I don't want to have to set Cloudflare as the provider each time I use nuxt image. Can't I set a different provider as default other than the ipx?
2 Replies
Hi @Mads. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can set a different default provider for the Nuxt Image module instead of the default ipx provider. To do this, specify the provider you want (e.g., Cloudflare) in your
nuxt.config.ts
under the image
configuration. This way, you don't need to set the provider on every <NuxtImg>
usage.
Here’s how you can set Cloudflare as the default provider:
With this configuration, all <NuxtImg>
components will use Cloudflare as the provider by default, unless you override it in the component itself. This approach works for any supported provider, not just Cloudflare. The default provider is set using the provider
key in the image
config block Get-started: provider.
If you do not specify a provider, Nuxt Image defaults to ipx
(or ipxStatic
for static sites) Get-started: Providers.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@335112909350895632> Kapa.ai is still learning and improving, please let me know how I did by reacting below.