-
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
Watch mode: git diff
on macOS triggers rebuild
#52876
Comments
#52535 feels related, if Windows suffers from the same problem with the new watching (though that example is |
I can confirm that git diff started triggering this for me (which was happening every time I switched to VSCode) and that |
I can confirm this behaviour too, unfortunately, thanks for raising this already |
https://unix.stackexchange.com/a/2803 If this is being handled purely by EDIT: I have confirmed this is a Node.js issue by reproducing it without TypeScript. Just filed nodejs/node#49916 EDIT 2: Update from Node.js side - wontfix working as intended. So these extraneous events will remain unless TypeScript's |
Thanks for raising this issue, it was driving me crazy and it's nice to finally know the cause. If I tried to use watch I'd get seemingly random rebuilds and ~4 rebuilds on every change. This can get triggered by so many things. Even default vscode git integration refreshing its list of changed files causes the watcher to recompile. Or using the |
@OliverJAsh can you please try out #56403 (comment) to see if that helps |
I just gave it a go and unfortunately I'm getting an out of memory error. For reference I'm coming from v5.2.2. |
I just tested this in my reduced test case and it does seem to fix the problem. |
Bug Report
π Search Terms
π Version & Regression Information
β― Playground Link
N/A
π» Code
Steps to reproduce:
main.ts
andtsconfig.json
:main.ts
so Git has unstaged changes and then run:$ tsc --project tsconfig.json --watch --diagnostics
git diff
.π Actual behavior
tsc
rebuilds becausegit diff
bumps the access timestamp (seestat -x main.ts
).This is particularly problematic for me because I use
lazygit
which refreshes the Git diff every few seconds.Screen.Recording.2023-02-20.at.20.07.44.2.mov
--
Output from
tsc
:π Expected behavior
tsc
should not rebuild when the access timestamp changes.I suspect this is due to the behaviour of
fs.watch
. In that case, is there anything else we can do to improve the default behaviour for macOS users? (Assuming this issue only occurs on macOS because I haven't been able to test on other platforms.)Note I am able to workaround by setting any of the following variables in my shell RC file:
The text was updated successfully, but these errors were encountered: