-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add web worker support (Partytown) #182
Comments
Do we need partytown ? I think @danielroe was working on something |
I think that's for partykit |
This wouldn't work, partytown's main work is creating a proxy for all the unsupported APIs, i.e reading / writing to the DOM should work. I don't think this would work with nuxt-workers |
This API would be really fantastic 👏 |
@harlan-zw I would argue that webworker: true should be the default. What do you think ? Is there a real-life scenario where not using a webworker is slower? |
Offloading to web workers is quite buggy and can in some cases lead to worse performance (pretty much anything UI heavy). I started exploring this issue and I'm considering a custom implementation over Partytown, it will take me some time to finish prototyping this. Initial support will be added for analytic scripts as they are less complicated and can be made the default when |
🆒 Your use case
Out-of-the-box Nuxt Scripts won't provide any significant performance gains for most people, the only performance improvement is loading third-party scripts as Nuxt app hydrates, instead of beforehand, which may help with reducing blocking time.
We provide some options that can solve these performance issues for third-party scripts through delaying scripts until they're needed or Facade components.
However, some users will need to load these scripts as quickly as possible without slowing down the Nuxt app hydration. This is the ideal use case for web workers (Partytown).
Related #56
🆕 The solution you'd like
We should be able to provide a simple flag to the
useScript
composable that will offload it to the webworker, no other functionality should change.Under the hood, this will use Partytown. We will either integrate directly with https://github.com/nuxt-modules/partytown or write bespoke code.
All other functionality should work the same.
🔍 Alternatives you've considered
No response
ℹ️ Additional info
No response
The text was updated successfully, but these errors were encountered: