Nuxt img is not preloading in ssr somehow
Hi guys!
Why is my NuxtImg not preloads in ssr?
2 Replies
Hi @hz2222. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
If your
<NuxtImg> is not preloading in SSR, here are some key points from the knowledge sources:
- The Nuxt Image module provides a preload prop for <NuxtImg>, which should add a corresponding <link rel="preload"> tag to the page's head when used. Example usage:
This is the intended way to trigger image preloading in Nuxt with SSR enabled Nuxt Image preload prop.
- For the preload to work as expected in SSR, your image source (src) should be correct and accessible. For local images, the path should be relative to the public/ directory (e.g., /nuxt-icon.png), not from assets/ unless you have configured the image module to use a different directory Nuxt Image usage.
- If SSR is disabled (ssr: false in your nuxt.config), image optimization and preloading during static generation will not work as expected. Make sure SSR is enabled if you want SSR preloading Static Images and SSR.
- There is no explicit mention in the knowledge sources of a known bug or limitation that would prevent <NuxtImg preload /> from working in SSR, provided the above conditions are met.
If you are following these guidelines and still not seeing the preload link in your SSR output, the knowledge sources do not provide further troubleshooting steps or known issues. You may want to check your Nuxt and Nuxt Image module versions, and ensure your configuration matches the documented usage.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@993174034940444752> Kapa.ai is still learning and improving, please let me know how I did by reacting below.