megasanjay / vue3-lottie

A simple Vue 3 component for using Lottie animations in Vue 3
https://vue3-lottie.vercel.app/
MIT License
375 stars 34 forks source link

Failed to resolve component #523

Closed artrayd closed 8 months ago

artrayd commented 8 months ago

Failed to resolve component: Vue3Lottie If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

Not working in Nuxt3, done according to provided guidelines

import { Vue3Lottie } from 'vue3-lottie'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.component(Vue3Lottie, { name: 'Vue3Lottie' })
})

Nuxt: 3.9.3

artrayd commented 8 months ago

Regular import works well

<template>
    <client-only>
      <Vue3Lottie :animationData="animationData" :height="200" :width="200" />
    </client-only>
</template>

<script setup lang="ts">
import { Vue3Lottie } from 'vue3-lottie'
</script>
Mini-ghost commented 8 months ago

@artrayd

If you want to install the vue3-lottie plugin in nuxt, you should write the following code:

import Vue3Lottie from 'vue3-lottie'

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(Vue3Lottie)

  // If you want to customize the component name
  // nuxtApp.vueApp.use(Vue3Lottie, { name: 'LottieComponentName' })
})
megasanjay commented 8 months ago

Thank you @Mini-ghost, i'll make those changes in the docs

kratos-digital commented 7 months ago

This solution from @Mini-ghost returns same error for me, and when using import it works using animationLink, but not working when using json file.