Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The NuxtImg and NuxtPicture components can't be dynamically imported anymore #1298

Closed
LionelPaulus opened this issue Mar 22, 2024 · 1 comment

Comments

@LionelPaulus
Copy link

Hi 👋

It seems a regression was introduced with the Nuxt 3 support, we can't dynamically import the NuxtImg or NuxtPicture anymore.
This is not working anymore:

<component
  :is="'NuxtPicture'"
  src="/images/mountains_2.jpg"
  width="3750"
  height="2500"
/>

Reproduction link: https://stackblitz.com/edit/nuxt-image-emr3gd?file=app.vue

Thanks in advance for your help 🙏

@danielroe
Copy link
Member

danielroe commented Mar 22, 2024

This is a change between Nuxt 2 -> Nuxt 3. You can instead do this:

<script setup>
import { NuxtPicture } from '#components'
</script>

<template>
	<component
	  :is="NuxtPicture"
	  src="/images/mountains_2.jpg"
	  width="3750"
	  height="2500"
	/>
</template>

in your component, and use it.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants