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

Add web worker support (Partytown) #182

Open
harlan-zw opened this issue Jul 24, 2024 · 4 comments
Open

Add web worker support (Partytown) #182

harlan-zw opened this issue Jul 24, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@harlan-zw
Copy link
Collaborator

harlan-zw commented Jul 24, 2024

🆒 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.

useScript('/script.js', {
  webworker: true,
})

All other functionality should work the same.

🔍 Alternatives you've considered

No response

ℹ️ Additional info

No response

@huang-julien
Copy link
Member

Do we need partytown ? I think @danielroe was working on something

@harlan-zw
Copy link
Collaborator Author

I think that's for partykit

@huang-julien
Copy link
Member

@harlan-zw
Copy link
Collaborator Author

harlan-zw commented Aug 22, 2024

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

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

No branches or pull requests

2 participants