|
1 | 1 | # `tsx watch` + `concurrently` + `Windows` issue repro |
2 | 2 |
|
3 | | -### Reproducing the issue |
| 3 | +## Reproducing the issue |
4 | 4 |
|
5 | | -1. Run `npm install` to install dependencies. |
6 | | -2. Uncomment 1 line out of the first 4 lines in `src/index.ts` and leave the other 3 commented. |
7 | | -3. Run `npm run noIssue1`, then `npm run noIssue2`, then `npm run noIssue3`. You should see **Everything is fine!** in the console. |
8 | | -4. Run `npm run issue` and `tsx watch` will not run, and you will not see **Everything is fine!**. |
| 5 | +### If you have a Windows machine |
9 | 6 |
|
10 | | -### Explanation |
| 7 | +*(In these steps `<module>` is any one of the following `chalk`, `prom-client`, `swagger-stats`, `googleapis`)* |
11 | 8 |
|
12 | | -1. `noIssue1` runs because `tsx watch` is running without `concurrently`. |
13 | | -2. `noIssue2` runs because we removed `watch` out of the `tsx` script. |
14 | | -3. `noIssue3` runs due to a [workaround](https://github.com/vercel/turbo/issues/7834#issuecomment-2033172950) found by the [turbo](https://github.com/vercel/turbo) team. |
| 9 | +1. Clone the repository. |
| 10 | +2. Run `npm install tsx concurrently` to install dependencies. |
| 11 | +3. Run `npm install <module>`. |
| 12 | +4. Run `npm run tsxWatch --module=<module>`, then `npm run concurrently-without-watch --module=<module>`, then `npm run watch-with-concurrently-hack --module=<module>`. You should see **Everything is fine!** in the console. |
| 13 | +5. Run `npm run watch-with-concurrently --module=<module>` and `tsx watch` will not run, and you will not see **Everything is fine!**. |
15 | 14 |
|
16 | | -### Notes |
| 15 | +### If you don't have a Windows machine |
| 16 | + |
| 17 | +1. Fork this repository, then go to the **Actions** tab in your fork. |
| 18 | +2. Click on the action **Scripts with no issue** in the left pane. |
| 19 | +3. Click on **Run workflow** then **Run workflow**. |
| 20 | +4. After about a minute you should see all the jobs ended with success, because each run script had **Everything is fine!** in its output. |
| 21 | +5. Gob back and click on **Reproduce tsx watch issue** action in the left pane of the **Actions** tab. |
| 22 | +6. Click on **Run workflow** then **Run workflow**. |
| 23 | +7. Inspect the pending run, and specifically the **Run issue causing script** step, which is running the script `concurrently "npm run expect" "npm run tsxWatch"`, and you should see that `npm run expect` ran successfully (`"Expecting tsx watch to run ./src/using-chalk.ts..."`), but `npm run tsxWatch` doesn't run at all, and you will not see **Everything is fine!**, as can be seen in the following screenshot. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +## Explanation |
| 28 | + |
| 29 | +1. `tsxWatch` script runs because `tsx watch` is running without `concurrently`. |
| 30 | +2. `concurrently-without-watch` runs because we removed `watch` out of the `tsx` script. |
| 31 | +3. `watch-with-concurrently-hack` runs due to a [workaround](https://github.com/vercel/turbo/issues/7834#issuecomment-2033172950) found by the [turbo](https://github.com/vercel/turbo) team. |
| 32 | + |
| 33 | +## Notes |
17 | 34 |
|
18 | 35 | 1. `tsx watch` hangs on `Windows` even without using `concurrently` as can be seen on that [previously linked issue](https://github.com/vercel/turbo/issues/7834), which provides more evidence that this issue is not a [concurrenlty](https://www.npmjs.com/package/concurrently) or [turbo](https://github.com/vercel/turbo) issue but rather a [tsx](https://www.npmjs.com/package/tsx) one. |
19 | | -2. The workaround proposed by the turbo team and used on the `noIssue3` script cannot be considered a real solution because `npm` scripts are used on different platforms but `< NUL` is a windows thing. |
| 36 | +2. The workaround proposed by the turbo team and used on the `watch-with-concurrently-hack` script cannot be considered a real solution because `npm` scripts are used on different platforms but `< NUL` is a windows thing. |
0 commit comments