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
{{ message }}
Repository navigation
tsc --build --watch (with or without --incremental) touches all files causing problems for downstream toolingΒ #46661
This is the behavior in every version I tried, and I reviewed the FAQ for entries about timestamp/touch
β― Playground Link
N/A
π» Code
tsc --build --watch
π Actual behavior
Given a TSC output including:
-rw-r--r-- 1 root root 28561 Nov 3 13:25 app.js
-rw-r--r-- 1 root root 11643 Nov 3 13:25 app.js.map
Change a single file that isn't app.ts results in:
-rw-r--r-- 1 root root 28561 Nov 3 13:37 app.js
-rw-r--r-- 1 root root 11643 Nov 3 13:37 app.js.map
This completely kills downstream tools (e.g. the karma testing tool, when it is watching the output) that are watching the files for changes. Yes these could do a better job but the cause just seems so unnecessary and avoidable (especially with the --incremental option!).
π Expected behavior
-rw-r--r-- 1 root root 28561 Nov 3 13:25 app.js
-rw-r--r-- 1 root root 11643 Nov 3 13:25 app.js.map
Changes to TS files don't result in any changes to any JS file that didn't have it's TS file changed
-rw-r--r-- 1 root root 28561 Nov 3 13:25 app.js
-rw-r--r-- 1 root root 11643 Nov 3 13:25 app.js.map
I've tried with and without the --incremental flag and no joy.
Karma watch seems to be based on timestamps, so when one typescript file changes, tsc --watch touches all files and then karma change notifications happen for ALL files (this is really, several minutes sometimes, slow).
I completely understand that karma should be better in this, however the root cause as I see it is that tsc shouldn't be touching files that it doesn't need to. There may be several other tools that have this same problem.
Weβve opened #46677 to track experiments with this. It may be a while before we can get to it, so I would encourage you to subscribe there (TypeScript Bot (@typescript-bot) will eventually close this issue). Weβre unfortunately at a temporary shortage of people who have a deep understanding of our watch/build/incremental mode stuff, but itβs something we know we need to give more attention to when we can. I just wanted to convey that this is expected behavior for now, but weβre listening to feedback, but also you may want to investigate some workarounds in the short term. Thanks for understanding!
Activity
andrewbranch commentedon Nov 3, 2021
Itβs not unnecessary: 7b290fd
Sounds like this is used to tell future invocations of tsc that outputs are up-to-date, allowing work to be skipped.
jfstephe commentedon Nov 3, 2021
Andrew Branch (@andrewbranch) thanks for responding.
I'm not disputing that this is how it works, merely that perhaps there are better ways that don't affect downstream operations.
This issue definitely exists. tsc may be working as intended, but not as it is needed to or IMHO should.
Could the incremental data not contain information to remove the need to do this (for example)?
andrewbranch commentedon Nov 3, 2021
Iβm curious if youβre having issues with anything besides Karma. Also what does it mean for them to be βcompletely killedβ?
jfstephe commentedon Nov 4, 2021
Hi, yeah I should have elaborated.
Karma watch seems to be based on timestamps, so when one typescript file changes, tsc --watch touches all files and then karma change notifications happen for ALL files (this is really, several minutes sometimes, slow).
I completely understand that karma should be better in this, however the root cause as I see it is that tsc shouldn't be touching files that it doesn't need to. There may be several other tools that have this same problem.
andrewbranch commentedon Nov 4, 2021
Weβve opened #46677 to track experiments with this. It may be a while before we can get to it, so I would encourage you to subscribe there (TypeScript Bot (@typescript-bot) will eventually close this issue). Weβre unfortunately at a temporary shortage of people who have a deep understanding of our watch/build/incremental mode stuff, but itβs something we know we need to give more attention to when we can. I just wanted to convey that this is expected behavior for now, but weβre listening to feedback, but also you may want to investigate some workarounds in the short term. Thanks for understanding!
jfstephe commentedon Nov 4, 2021
Awesome thanks.
jfstephe commentedon Nov 5, 2021
Please also note that we are running on docker which is I suspect a contributing factor to the performance issue for downstream tooling.
typescript-bot commentedon Nov 7, 2021
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
DanielRosenwasser commentedon Jun 8, 2022
If you'd be would be willing to try out tomorrow's nightly build, we'd appreciate the feedback!