Search code examples
vue.jsnuxt.jslottie

Vue-Lottie and Nuxt


Anyone get Vue-Lottie working with Nuxt? I tried to import it as Vue-Lotti said to:

import Lottie from './lottie.vue';

this says it cant find the package.

Then I tried how Nuxt had it:

import Lottie from 'vue-lottie';

this gives me an "Unexpected token <" error.

What am I missing?


Solution

  • I use lottie-web instead of vue-lottie with my VueJS apps and I had a similar problem to yours.

    The way I made it work was to install it normally with npm install lottie-web and then call it in my components as: import lottie from 'lottie-web/build/player/lottie';.

    Perhaps you have to also type in the path in the same manner with vue-lottie.