privatenumber / tsx

⚡️ TypeScript Execute | The easiest way to run TypeScript in Node.js
https://tsx.is
MIT License
8.66k stars 132 forks source link

tsx >= 4.15.0 breaks playwright code #608

Closed RunOrVeith closed 3 days ago

RunOrVeith commented 3 days ago

Acknowledgements

Minimal reproduction URL

https://github.com/RunOrVeith/tsxPlaywrightBug

Problem & expected behavior (under 200 words)

I opened an issue with more information in playwright, but this is probably a tsx/esbuild issue.

Bugs are expected to be fixed by those affected by it

Compensating engineering work will speed up resolution and support the project

privatenumber commented 3 days ago

Im not able to look into this yet but I took a glance at the reproduction and it didnt look minimal.

Can you remove anything that isnt necessary to reproduce the error?

RunOrVeith commented 3 days ago

No, sorry. This is as minimal as I can make it. I was unable to reproduce it with less than that. It's only a few lines, but of course the playwright implementation is more. Playwright is somehow serializing the code inside addInitScript and sending it to the browser. But this is a tsx issue because it works with node. The steps to reproduce are (inside my example repo):

npm i
npx playwright install
npx tsx index.ts

The problem is also resolved with the workaround in https://github.com/evanw/esbuild/issues/2605#issuecomment-2146054255, so this might be a duplicate