image icon indicating copy to clipboard operation
image copied to clipboard

Importing components directly

Open adamchipperfield opened this issue 3 years ago • 1 comments

Is there a way I can import the nuxt-img and nuxt-picture components explicitly? I have a helper which I need to pass components to, but the global components aren't available there.

I.e. import { NuxtImg } from '@nuxt/image'

adamchipperfield avatar May 24 '22 10:05 adamchipperfield

Did you solve it? I have the same problem, I need this to type a component's props.

andresespinosapc avatar Sep 06 '22 19:09 andresespinosapc

I solved it with:

import NuxtImg from '../../node_modules/@nuxt/image/dist/runtime/components/nuxt-img.mjs'

davestewart avatar Sep 14 '23 12:09 davestewart

This should be possible with import { NuxtImg } from '#components' in Nuxt 3.

danielroe avatar Sep 15 '23 16:09 danielroe