airbnb / lottie-web

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

Bug: useWebWorker not working in build mode #3080

Open RomanSkrypnik opened 3 months ago

RomanSkrypnik commented 3 months ago

Tell us about your environment


What did you do? Please explain the steps you took before you encountered the problem. I decided to enable webworker for lottie on my nuxt project. Everything works fine in dev mode but doesn't work in build one

What did you expect to happen? Animation works with webworker in build mode

What actually happened? Please include as much relevant detail as possible. Here is my repro: https://github.com/RomanSkrypnik/nuxt-lottie-worker-issue I'm facing this error:

image image

P.S: I left comment where you can comment web worker to check ( app.vue ):

image

sync42johnny commented 3 months ago

i have the same problem(

RomanSkrypnik commented 3 months ago

I have found the root of the problem - minification Not minified lottie.js works fine but if I use minified one - getting this error I found out it by using CDN-s: https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js - web worker won't work https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.js - works with web worker

RomanSkrypnik commented 3 months ago

This part of code causes the problem:

image

Minifier doesn't transform _workerSelf in a - that why a is not defined After renaming _workerSelf to a manually - everything works fine

RomanSkrypnik commented 2 months ago

@Hernan-Dev could you please check this issue?

Marvv90 commented 2 months ago

Same Problem here !