Repository navigation
[3.0] Typescript --build causes infinite loop of compiling #26612
Description
Expected behavior:
Using --build should not loop.
Actual behavior:
What is frustrating about reporting this issue is this is happening a big-ish monorepo and I've tried about 20 different configuration setups now and they seem to break in different ways so I it's hard to really point out what's causing this. It sometimes acts nicely and then at some point I'll see it going through an endless loop and kill it, but I often have little clue as to which save started the loop or which config caused which loop.
Once it does happen I can replicate it very consistently, and it happens often. Though replicating it in code for you would be really hard, as it's a large and layered monorepo.
Basically I have a monorepo with about 30 packages, 6 top level apps, and a lot of "middle" level packages along the way. Oftentimes packages use the same leaf-level ones.
I have validated many things: All the configs are valid, they all build properly by themselves and I can run just about any of them in order. There are no type errors.
I wrote a little more on it here: #25600 (comment)
Here's an example --verbose log:
[13:22:47] File change detected. Starting incremental compilation...
[13:22:48] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:22:58] File change detected. Starting incremental compilation...
[13:22:58] Found 0 errors. Watching for file changes.
[13:22:58] File change detected. Starting incremental compilation...
[13:22:58] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:23:08] File change detected. Starting incremental compilation...
[13:23:08] Found 0 errors. Watching for file changes.
[13:23:08] File change detected. Starting incremental compilation...
[13:23:08] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:23:18] File change detected. Starting incremental compilation...
[13:23:18] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:23:28] File change detected. Starting incremental compilation...
[13:23:28] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:23:38] File change detected. Starting incremental compilation...
[13:23:38] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-electron/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/css/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/config/tsconfig.json'...
[13:23:48] File change detected. Starting incremental compilation...
[13:23:48] Found 0 errors. Watching for file changes.
message TS6358: Building project '/Users/nw/projects/motion/orbit/packages/mobx-bridge/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/stores/tsconfig.json'...
message TS6358: Building project '/Users/nw/projects/motion/orbit/app/orbit-desktop/tsconfig.json'...
Activity
RyanCavanaugh commentedon Aug 24, 2018
I think Sheetal Nandi (@sheetalkamat) 's work to refactor the build queue may fix this, but need to verify
natew commentedon Aug 24, 2018
Ok, got a better view of the loop by running a different watcher. I edited a file in a deep nested package (the
configone) that is used by a lot of other ones:Not sure how helpful but it keeps going after this for a while.
sheetalkamat commentedon Aug 28, 2018
Can you please try typescript@next generated tonight (that is anything that's equal to or above typescript@3.1.0-dev.20180829) to see if it fixes the issue. thanks
natew commentedon Aug 29, 2018
Seems to get stuck now where it didn't before. It says file change detected, but then doesn't finish compiling.
Separately am seeing it says now that some style definitions don't exist when they show in the
.d.tsand were working in 3.0, which may be causing trouble saving as it doesn't like to save unless everything is compiled without error (is that a known bug too?):sheetalkamat commentedon Aug 29, 2018
You are running into queue not being reset correctly. #26742 should fix that.
sheetalkamat commentedon Aug 30, 2018
Nate Wienert (@natew) can you give typescript@next a try to see if things are working for you. Thanks
natew commentedon Aug 31, 2018
I actually don't see any file output file now when I change something in the parent app. It shows it noticed an update but nothing changes. Even deleting it's out folder and re-running tsc --build --watch nothing is output.
I'm seeing a new error in one of the packages, it's interesting. Maybe that's blocking build.
I have a pattern where I import a package and return its result like so:
And then in
xit has something like:For some reason now in the first output
.d.tsfile I see an error where it tries to inline thatColortype but it doesn't exist (notice red line):natew commentedon Aug 31, 2018
Ay. So downgraded and noticed both errors are happening on 3.0.3. I don't think they were happening on 3.0.1 but don't have so much time to debug. I ended up monkeypatching the bad type export.
Is it true deleting the build folder and then running
tsc --build --watchdoesn't output anything? And then hitting save on a file does nothing too? I had to go back and runtsc --buildwhich output properly and then re-run watch, and then saving.Edit: Actually that worked once, but now it gets stuck again after on successful save (on 3.0.3):
sheetalkamat commentedon Aug 31, 2018
The multiple File change detected should be fixed by #26782
Note that none --watch behavior (with or without --build) watch output folders as of now. so only changes in input are watched at moment.
sheetalkamat commentedon Sep 4, 2018
Nate Wienert (@natew) Can you please check with typescript@next if your issue is resolved. Thanks.
natew commentedon Sep 5, 2018
Yes, working great today. Thank you!