Home  >  Q&A  >  body text

Why does my Lottie animation load correctly on the localhost server but not on the deployment server?

So the problem is that all the Lottie animations load on my localhost server, but once the web app is deployed the animations don't load and I get some errors in the console. Animation files are .json files. My project is next js React project.

Link to lottie: https://lottiefiles.com/

But when I open the deployment server (vercel), the animation fails to load and I get some errors in the console. How can I solve this problem?

P粉662614213P粉662614213228 days ago420

reply all(2)I'll reply

  • P粉200138510

    P粉2001385102024-03-30 10:32:40

    Wherever you pass animationData, you can try JSON.stringify it

    JSON.stringify(animationData)

    reply
    0
  • P粉590428357

    P粉5904283572024-03-30 09:21:44

    You are trying on vercel, there are some problems, please check this github issue and leave a comment https://github.com/vercel/next.js/issues/42801#issuecomment-1317671110, one One solution is to disable swcMinify

    // next.config.js
    
    module.exports = {
      swcMinify: false,
    }

    reply
    0
  • Cancelreply