You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# terminal 1:
vite
# terminal 2:
tsx watch index.ts
Or:
index.ts
console.log("hello world");// import "mysql2"
Detailed Explanation
I was using concurrently with the mysql2 package, with tsx watch to run my code and watch for changes. At some point, it started freezing completely on startup. I even added a console.log at the very beginning of the entry point script that would not even print, which made me think it was an import issue (since I think imports run even before that console.log).
After disabling various parts of code, I finally disabled my import for mysql2 and it started running again. But, even if I did not use the value imported, just having the import "mysql2" by itself would cause it to freeze.
Finally, I tried running the two-part application without concurrently and just in separate terminals, and it worked fine, with the mysql2 import and everything.
I presume this is an issue with concurrently, mysql2, and tsx watch since it works fine if I remove any one of these three dependents (using tsx not in watch mode also works). I switched to npm-run-all and it works fine now. Not sure exactly what mysql2 is doing as a side-effect, or what breaks it when using concurrently.
Environment
OS: Windows 10 x64 Terminal: Powershell integrated in VSCode 1.96.2
Brief
Following setup freezes:
index.ts
hello world
does not log before app freezes.Works:
Or:
index.ts
Detailed Explanation
I was using
concurrently
with themysql2
package, withtsx watch
to run my code and watch for changes. At some point, it started freezing completely on startup. I even added aconsole.log
at the very beginning of the entry point script that would not even print, which made me think it was an import issue (since I think imports run even before thatconsole.log
).After disabling various parts of code, I finally disabled my import for
mysql2
and it started running again. But, even if I did not use the value imported, just having theimport "mysql2"
by itself would cause it to freeze.Finally, I tried running the two-part application without
concurrently
and just in separate terminals, and it worked fine, with themysql2
import and everything.I presume this is an issue with
concurrently
,mysql2
, andtsx watch
since it works fine if I remove any one of these three dependents (usingtsx
not inwatch
mode also works). I switched tonpm-run-all
and it works fine now. Not sure exactly whatmysql2
is doing as a side-effect, or what breaks it when usingconcurrently
.Environment
OS: Windows 10 x64
Terminal: Powershell integrated in VSCode 1.96.2
Minimal Example
I've reproduced this issue with two files:
package.json
:index.ts
:With these files, run:
The following shows that
hello world
does not log as expected:The following commands show that it does print when not using
concurrently
or when not usingwatch
mode:Also try commenting out
import "mysql2"
to see that this also works:The text was updated successfully, but these errors were encountered: