Description
With these issues in mind:
I saw mention of "tscserver"
- but I am not sure if that still exists - it sounds like that became tsc --watch
?
What I want to do:
Compile a .tsx file on demand, and when it's done compiling, send a socket message to the browser, telling the browser that the file is compiled and ready to be loaded into the browser.
The problem:
The problem is thattsc --watch
does not allow me to listen for when the compilation is finished.
Temporary solution:
So what I am currently doing now - instead of using tsc --watch
, I am just running tsc
as a child process on demand. When the child process closes, and exits with 0, I know compilation is done. And the problem is that it's a little bit slower this way, maybe 100 ms slower.
Longer term solution proposal:
As a better solution, it would be great to pre-start a Node.js process with tsc loaded already - essentially creating a tscserver
, but I am not sure if this is possible. Alternatively, tsc --watch
would allow me to somehow listen for compilation completion events.
To re-iterate, I am looking for:
- (a) a way to hook into tsc --watch, to create actions that occur after compilation completes,
and/or
- (b) a way to create tscserver that can process requests on demand, and where I can listen for compilation completion events.
Any help much appreciated, thanks.