airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
30.56k stars 2.88k forks source link

lottie worker is not work in lottie.min.js but lottie.js #2858

Open gaplo917 opened 2 years ago

gaplo917 commented 2 years ago

The lottie.useWebWorker(true) feature does not work in the minified environment.

Environment

Reproduce

using https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.9.6/lottie.min.js and lottie.useWebWorker(true)

Codesandbox: https://codesandbox.io/s/lottie-web-5-9-6-web-worker-bug-ndjm6i?file=/pages/_app.tsx:385-399 GitHub Repo: https://github.com/gaplo917/nextjs-lottie-webworker-sample/tree/lottie-web-5.9.6-min

Uncaught ReferenceError: a is not defined
    at self.onmessage (a0f03980-2142-4dfa-af78-89a0880123af:1:54)

Screen Shot 2022-09-27 at 5 14 08 PM

Expected Working Example

using https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.9.6/lottie.js and lottie.useWebWorker(true)

Screen Shot 2022-09-27 at 5 37 04 PM

Codesandbox: https://codesandbox.io/s/lottie-web-5-9-6-web-worker-nextjs-mnvkjd?file=/pages/_app.tsx:512-630 GitHub Repo: https://github.com/gaplo917/nextjs-lottie-webworker-sample/tree/lottie-web-5.9.6

bodymovin commented 1 year ago

Hi, I'm thinking of deprecating this method in favor of using the lottie_worker.js.
Do you have a use case where you'd prefer using this one instead?