Skip to content
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

Bug: useWebWorker not working in build mode #3080

Open
RomanSkrypnik opened this issue Mar 27, 2024 · 5 comments
Open

Bug: useWebWorker not working in build mode #3080

RomanSkrypnik opened this issue Mar 27, 2024 · 5 comments

Comments

@RomanSkrypnik
Copy link

Tell us about your environment


  • Operating System: Darwin
  • Node Version: v18.12.1
  • Nuxt Version: 3.11.1
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.5
  • Package Manager: yarn@1.22.19
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -
  • Lottie version - 5.10.2

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
Copy link

i have the same problem(

@RomanSkrypnik RomanSkrypnik changed the title [NUXT] useWebWorker not working in build mode Bug: [NUXT] useWebWorker not working in build mode Mar 28, 2024
@RomanSkrypnik
Copy link
Author

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 RomanSkrypnik changed the title Bug: [NUXT] useWebWorker not working in build mode Bug: useWebWorker not working in build mode Apr 1, 2024
@RomanSkrypnik
Copy link
Author

RomanSkrypnik commented Apr 1, 2024

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
Copy link
Author

@Hernan-Dev could you please check this issue?

@Marvv90
Copy link

Marvv90 commented Apr 11, 2024

Same Problem here !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants