-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Lottie is not displaying on prod site, but is working perfectly in local dev environment #2656
Comments
hi, have you tried using the lottie player from the cdn? At least to verifiy it's not a minification / obfuscation issue |
Having the same issue. Have you made any progress with this issue @jbellmont-phntm ? |
@therealsylaucoin do you have a link to check? |
Apologies for the late reply! I never found a solution. And now another colleague is having the same issue - it working on local, but after build and deploy, it's not appearing. Would be great if anyone else has figured out a solution. |
This is happening for me. The animation works completely fine locally, it does not work on the dev site. If you inspect the elements it seems to be animating but all the assets aren't sized properly and are invisible. The animation includes images and I thought including the images in the json would fix it but it doesn't. There are zero error messages indicating a problem. |
@Dylan-Wells-at-LION can you share a link to check the issue? |
@bodymovin It's for a client and behind a password so I can't post a link/login info to the dev site here. I tested the data.json on lottiefiles.com and although it looked a little incorrect it was visible. Sorry if that's not very helpful but is there any other info I can get to you? |
@Dylan-Wells-at-LION this is usually related to CSP or bundlers, but without an example it's hard to tell. |
@bodymovin I created a stripped down version for you to look at, it has the same issues as the real one. Here is what it should look like Screen.Recording.2022-05-11.at.1.55.56.PM.mp4Here is the link: [removed] |
Online: |
@bodymovin I created another version with just shapes instead of images on the same site and it works fine so I'm guessing it has something to do with how images are handled. |
@bodymovin The image are rendered and sized correctly when I use the |
@Dylan-Wells-at-LION can you try calling |
@Dylan-Wells-at-LION I think I found the issue. There is a global css selector applied to all image elements at the end of this file: |
@bodymovin Wow... Thanks for finding the issue even if it had nothing to do with Lottie. |
Im having the same issue.
{
"react": "18.2.0",
"next": "13.0.3",
"lottie-web": "^5.9.6",
} |
Was having the same issue with next.js. Change swcMinify to false in next.config.js:
|
This worked for Nextjs!! thanks |
I have the same problem with a javascript server using vite Svelte.
Working towards a solution. |
If you are using Vite and Svelte and it does not render in production it may be that you are not using the Svelte library for this files. The solution to this problem is to use it in the correct way. |
Currently, I am using
import Lottie from 'lottie-web';
import AnimationJson1 from '@/libs/lottie/animation-1.json';
const Component = () => {
React.useEffect(() => {
const lottieInstance = Lottie.loadAnimation({
container: document.getElementById('lottie-card-section-1') as HTMLElement,
autoplay: true,
loop: true,
renderer: 'svg',
animationData: AnimationJson1,
rendererSettings: {
className: svgStyles.svgSizeFix,
},
});
lottieInstance.setSpeed(0.5);
return () => {
lottieInstance.destroy();
};
}, []);
return (
<div className='flex flex-wrap items-center justify-center mt-0 relative z-10'>
<div
className='w-4/5 md:w-[30rem] lg:w-[45vw] h-[25rem] z-10 pointer-events-none select-none relative
ml-10'
id='lottie-card-section-1'
/>
</div>
);
} Hope that helps anybody who still want to use swcMinify option in nextjs and in general.
// Supports tailwind Dark mode `class`
import { Player } from '@lottiefiles/react-lottie-player';
const Component = () => (
<div className="relative">
<Player
src="/animation-1.json"
background="transparent"
speed={1}
controls={false}
loop
autoplay
className="h-52 md:h-60 lg:h-80 2xl:h-96 filter brightness-100 dark:brightness-90
transition-all duration-300 ease-out"
/>
</div>
); Cheers! if I helped you in any way 🍻 |
I am using vite and three.js, after putting the Lottie json file into the public/images folder it solved the problem. |
Tell us about your environment
"lottie-web": "^5.7.3",
"ngx-lottie": "^6.3.0",
Tested on:
2021
What did you do? Please explain the steps you took before you encountered the problem.
What did you expect to happen?
What actually happened? Please include as much relevant detail as possible.
Please provide a download link to the After Effects file that demonstrates the problem.
Are there any reasons why this might be happening? I am convinced it's due to the exporting of the JSON file, as I've done as much as I can on the dev side to fix the potential issue.
The text was updated successfully, but these errors were encountered: