Hello! Just curious if anyone here has been able t...
# support
n
Hello! Just curious if anyone here has been able to load RudderStack using web workers? For example something like Partytown? https://partytown.builder.io
g
What are the drawbacks and limitations of loading scripts via web worker?
n
Hey, @gentle-petabyte-80785! Didnt see your response until now. It cannot interact directly with the DOM would be the major drawback as far as I know. Also, for any “critical renders” it would not be suitable as it loads async off the main thread. With partytown you can still attach things to the “window” object, as they use some kind of internal proxy system I do not fully understand. I have done some experimenting with Partytown and Rudderstack, and have gotten it to work unreliably. Sometimes it works, other times it dosent. I have not been able to get to the bottom of it
g
Web workers inherently have some limitations such as lack of access to document and web APIs. Partytown looks like a hackish way to overcome those limitations partially. So I'd totally expect some things to break if I use this solution.
n
Yea, for sure. But if I cut out Rudderstack and load my Hotjar, google ads, facebook pixel, google ads etc scripts manually through a web worker, using partytown it works fine. Meaning in theory that it should be possible with Rudderstack as well
g
Did you see any error in developer console?
n
Yeah, various errors. A bit hard to remember, was months ago that I fiddled around with it
I can try again this weekend and get back to you