-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
tsc: watch mode doesn't discover new files #4553
Comments
looks like another place where we should use the new node watch APIs: see #4643 |
+1 to have this soon. Is it for 1.7 like in #5076 or for 1.8 like here? |
@alexeagle these two issues are both for 1.7 |
+1 to have this soon(er), this is annoying :) |
@dbaeumer can you give latest a try? |
Hmm - I'm using 2.0.10 and tsc -w does not spot new files. If I ctrl-c and restart, it then transpiles |
@jmls Can you provide the following info:
|
Of course. node: 4.6.1, 7.0.0 and 7.2.0 demo project at https://github.com/jmls/tsc-watch I've created a new file by copying in the shell ( |
Do you run |
I do - but I am amazed that tsc still uses fw.watch if it has such a fundamental problem. |
Indeed it is not ideal and creating a file watcher for node is out of the domain of our main focus. If there are no signs in addressing this in upcoming node updates, I do think a third-party package is the most likely approach. Though we are very cautious in adding third-party dependencies (currently we have none). |
This is a very relevant issue to my organization. I would like you to re-open it. We, and I assume many others, do our building in Docker containers, with source directories mounted in volumes. This gives us the assurance that all devs use the same environment as production. The Docker container, of course, is running Linux, where node's fs.watch is broken. We let the tsc --watch process inside Docker pick up changes made on the outside, giving us a very nice dev cycle where compilation and tests are re-run automatically whenever a file is changed. We absolutely want to keep using the native
So I ask you: Given the prevalence of people using Docker for development, please start considering Linux a supported platform, and ensure that your amazing Since you don't want strict dependencies on external libraries, I suggest doing this with an optionalDependency. |
const chokidar = require('chokidar');
const watcher = chokidar.watch(<dir>);
watcher.on('add', function(p){
/// a file was added with path = p
}); this should be easy to add to tsc -w, right? |
Alright so I already had created a tsc --watch wrapper that could spawn separate watchers for each tsconfig.json file in a project. tsc -w only seems to be able to watch for changes that pertain to one tsconfig.json file... So I added this chokidar watch feature to the same project that can take into account multiple tsconfig.json files, so now the watcher will restart when a new file is added. I created this recently, so it's nothing great, but star it if you are interested in me making it better. |
Is this supposed to work? I don't see it with my system. Frustrating for bigger monorepos because have to restart a bunch of watchers for any file addition anywhere. |
Ah figured it out, I had this in my tsconfig:
Changing to this works:
|
Observe: it is not transpiled.
The text was updated successfully, but these errors were encountered: