johnnyno
NuxtImg inside dynamic components during site generation
What is the best way to include images during site generation for NuxtImg wihtin dynamic components? Problem is that when NuxtImg is in component that during static site generation is not part of the DOM (eg v-if="false") then images are not generated in /_ipx/ folder. When user visits page, hydration completes and dynamic component can be loaded (v-if="true"), but corresponding images are missing in /_ipx/ folder. How to tell NuxtImage to not skip those. There are workarounds like image preload or add invisible NuxtImg to DOM but I am looking for more elegant and clear solution.
Example code:
<div v-if="condition">
<NuxtImg width="80" height="80" :src="..." loading="lazy" placeholder/>
</div>
7 replies