QwikDev / partytown

Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
https://partytown.qwik.dev
MIT License
13.1k stars 437 forks source link

fix: avoid syntax collision with self-invoking function #615

Closed aaa123eee closed 1 week ago

aaa123eee commented 3 months ago

What is it?

Description

Currently, the replacement of this symbol includes an expression wrapped with braces. It might cause an incorrect syntax if the previous function declaration has no semicolon at the end

Example: setupUid2Sdk is called immediately image

I suggest an adjustment to avoid syntax collision in 3rd party scripts since we have no control over those scripts. Instead of an expression in braces, we can encapsulate this logic using a function

Checklist:

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
partytown ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2024 4:09pm
aaa123eee commented 3 months ago

linting is failing on the file I didn't touch :-(

aaa123eee commented 3 months ago

I've just added a typescript version bump that should solve the issue with the lint job https://github.com/BuilderIO/partytown/pull/616

aaa123eee commented 1 week ago

unfortunately this fix breaks other usages, converted to draft

anyway it would be nice to solve the issue anyhow

gioboa commented 1 week ago

Thanks for the update, let's create an issue for that and we can link this PR too. I'll close this one because I would like to have no pending PRs in the list. Thanks for your help btw 👏