Gamote / lottie-react

A lightweight React library for rendering complex After Effects animations in real time using Lottie.
https://lottiereact.com
Other
786 stars 59 forks source link

Not working with next js #79

Closed denvradiy closed 1 year ago

denvradiy commented 1 year ago

Describe the bug I use this package with nextjs. Lottie animation works locally but doesn't work on production build, it's not showing and throwing tons or the same errors :

Screenshot 2022-11-25 at 00 29 29

next version 13, lottie-react version 2.3.1

How can I fix this?

pbozyk commented 1 year ago

I have the same problem. It works when next is in development mode, but not after a production build. If you disable minimizing your webpack it will work. This is not a solution, just my observation :(

Gamote commented 1 year ago

@denvradiy @pbozyk Hello, please create a MRE (minimal reproducible example) and I will look into it.

pbozyk commented 1 year ago

@Gamote - nothing specjal - standard configuration of NextJs with TaiwindCSS. I think its a Next13 problem (TURBOPack). When I try use lottie-react it works when i use next dev, but doesnt work after build (next build / next start).

   "next": "latest",
    "next-compose-plugins": "^2.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
Gamote commented 1 year ago

It will greatly help and speed up the process if you guys create a MRE repo that I can use to recreate the issue. Thank you for your time.

denvradiy commented 1 year ago

I was creating a MRE repo and realised that lottie animation works with "next": "13.0.5", but my other project where I was using lottie-react has "next": "13.0.4" and it's not working there. @pbozyk try "next": "13.0.5". Looks like something was fixed

denvradiy commented 1 year ago

https://github.com/denvradiy/lottie-error @Gamote here is MRE

Gamote commented 1 year ago

@denvradiy good to hear that you have found a fix. And thank you for taking the time to create the MRE.

@pbozyk can you try to see if next@13.0.5 is fixing your issue as well?

mariosantosdev commented 1 year ago

@denvradiy good to hear that you have found a fix. And thank you for taking the time to create the MRE.

@pbozyk can you try to see if next@13.0.5 is fixing your issue as well?

It's work, thanks 😁