privatenumber / tsx

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

`tsx watch` in `concurrently` hangs on Windows if there are certain modules imports #623

Open NadAlaba opened 3 months ago

NadAlaba commented 3 months ago

Acknowledgements

Minimal reproduction URL

https://github.com/NadAlaba/tsx-issue-repro

Problem & expected behavior (under 200 words)

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 months ago

This issue is almost certainly not a concurrently issue because it happens without concurrently as was discovered on this https://github.com/vercel/turbo/issues/7834.

Can you remove concurrently from your minimal reproduction then?

Can you also add a GitHub Action that reproduces the bug on Windows? I don't have a Windows

NadAlaba commented 3 months ago

Can you remove concurrently from your minimal reproduction then?

@privatenumber As far as I can tell this issue requires tsx watch to run through concurrently or turbo in order to happen. I was saying it happened without concurrently, but with turbo on the linked issue.

Can you also add a GitHub Action that reproduces the bug on Windows? I don't have a Windows

Done!

iuroc commented 2 months ago

This issue is caused by import/require "process" combined with process.stdin.on("data", ()=>{}). https://github.com/privatenumber/tsx/blob/bd83d3bf59e39767ec64eec86fe5b48a8e50b991/src/watch/index.ts#L219 You can add the -r option to concurrently to resolve it.

Disabling OnReturnKey can also solve the issue.

I have submitted a PR (https://github.com/privatenumber/tsx/pull/639) that allows you to manually disable OnReturnKey by using --on-return-key=false.

lord007tn commented 2 months ago

if you are using turbo you can update to latest version of turbo 2.1.1 and set the UI mode to be tui

this solved the problem for me

i don't now the root cause or why its happening i have almost identical project and i didn't have the problem with it on the previous version of turbo

two project have same server Hono js and they have same structure and same package versions one hono works fine and the other one don't