Open carlos-algms opened 1 year ago
Hello @carlos-algms , this is a great idea. Let's leave the issue open to see if it gathers some traction, and if so, I'll be happy to work on it or let anyone else do it.
This should definitely be done, as the script will be offloaded to the service-worker on a different thread.
+1
I think this is not really necessary, since Next.js scripts already have experimental support for PartyTown.
https://nextjs.org/docs/basic-features/script#offloading-scripts-to-a-web-worker-experimental
Edit: I just found out that we need to change some things in order for partytown to communicate with google analytics, so there needs to be some minor changes in order for it to work with webworkers.
To get better performance and higher Lighthouse scores, it is possible to delegate the third-party scripts to web workers.
That's where PartyTown comes into place.
https://partytown.builder.io/nextjs