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

:animationData="require('@/assets/animation.json')" doesn't work with Vite #17

Closed
rhclayto opened this issue Aug 21, 2022 · 3 comments
Closed

Comments

@rhclayto
Copy link

The Vue 3 example has :animationData="require('@/assets/animation.json')" in the template. However, require fails when using Vite. Is there an alternative way of telling lottie-web-view what animation data file to use?

@rhclayto
Copy link
Author

rhclayto commented Aug 21, 2022

I found out how to make it work with Vite:

<script setup>
  import animationURL from '@/assets/animations/spinningLogo.json';
</script>
<template>
  <lottie-animation
    ref="anim"
    :animationData="animationURL"
  />
</template>

Please consider adding this to the Readme.

garbit added a commit that referenced this issue Aug 22, 2022
Updated README in response to: #17
@garbit
Copy link
Owner

garbit commented Aug 22, 2022

Hi @rhclayto, thank you for highlighting this issue. I've updated the README in response to your feedback.

Please see: 65fad46

@garbit garbit closed this as completed Aug 22, 2022
@garbit garbit reopened this Aug 22, 2022
@rhclayto
Copy link
Author

Great! Perfect!

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