-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Implement '--watch' for tsc.exe #2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So watch does not work on windows?
|
Just to be clear, |
As Daniel says, and as I wrote: "The current host" does not support the watch. I use node now as a host and come along well. So for me this is not an issue anymore and I think others will be fine as well with node as a host. |
I realy do not get what means - "node as a host" |
javascript code needs some program that executes it. That is either a browser or node.js or something else, like tsc.exe. The typescript compiler is tsc.js and you can use it for example by running
IN the first case, tsc.exe is a javascript runner, or in other words a "host" for tsc.js . In the second case, node.js is the runner, or "host". Besides executing the js code, the host provides some services like file-watching to the js code. And here is the missing piece: tsc.exe does not implement file watching, while node.js does. So using
you get file watching while
will throw
|
I'm not sure why this was closed. Supporting --watch for our tsc.exe host would both be possible and desirable. Right now the limiting factor is that our tsc.exe host is a bit of ugly C++, that uses some ancient COM interfaces for Chakra that we haven't spent much effort on. Our options are:
Ideally, we would open source these efforts as well. |
i closed it, because i opened it and found a workaround. |
So workaround for winodws is to search tsc.js and make cmd file to start it with node. :) |
No, if you're going to use node, we'd recommend you install TypeScript via |
@DanielRosenwasser : right, this is clean and portable rem usage: ts app
node X:\typescript\bin\tsc.js -w --sourcemap %1.ts --out js\%1.js |
@urbanhop hope you won't mind, I modified your script to be in a code block so it's a little more readable. |
thx! |
Please add to the "tsc --watch" doc that it is not supported on straight windows hosts but works on node on windows. That would save everyone's time. |
Would it be possible to get a cmd file that watches the .ts files and recompiles them? |
@fjanon not really, we'd be better off adapting the host to take on this functionality. |
How about this approach around this line: declare hostSystemSupport: ts.System;
if (typeof hostSystemSupport !== 'undefined') {
return hostSystemSupport;
}
else if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") {
return getWScriptSystem();
}
else if (typeof module !== "undefined" && module.exports) {
return getNodeSystem();
}
else {
return undefined; // Unsupported host
} So rather than faking WSH or node (both rich and complex apis), your Chakra host will implement exactly what tsc needs in the first place. And as a side effect it will open the door for easy hosting of tsc in other weird and wonderful scenarios. |
Correct me if I'm wrong but if I create a new Will be possible to add into the |
currently the compiler only adds watches to files. the problem is node does not provide a native directory watcher capabilities. we would have to either do it based on file watchers, which would not scale, or include a timestamp based implementation. we are open to suggestions here if any one has better ideas on how to get this to work. I do not think this is related to this issue. this issue is to enable --watch for tsc.exe. we should file a different issue for the directory watcher in --w. |
I agree with you @mhegazy, that was my impression when I start writing the comment. I will continue the discussion in other issue. Thanks for the feedback and the information about Node.js. |
This has been implemented, I think this issue can be closed? |
no. this has not been implemented. |
This is the solution which works for me. see |
Can someone explain to me if Sorry, but I'm really frustrated and finding this command line stuff to be a bit unnecessary. |
Since |
error TS5001: The current host does not support the '--watch' option.
I got the really cool watch option working using the typescript spirce cde. but wouldn it be cool to have it working with tsc?
The text was updated successfully, but these errors were encountered: