question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project compiles OK but hangs when --watch is added

See original GitHub issue

TypeScript Version: 3.0.0-dev.20180616 and 2.9.2

Search Terms: typescript watch --watch hangs stalls slow

Hi I have minimized one of my projects to an example source (which I have attached [1]) that:

  1. Compile fine when not using watch mode (takes about 5 seconds to compile on my machine)
  2. Hangs the compiler when using watch mode (doesn’t complete it’s compile).

To compile the example:

  1. download the zip and unzip it and enter that directory
  2. run yarn install to add the project’s deps. 3a. run yarn tsc-ok for the example where it does compile 3b. run yarn tsc-bad for the example where it doesn’t

BTW: Is there some way for me to tell the compiler to dump out the source files it is processing as it processes them? It would be extremely helpful for tracking this down to the specific issue.

1: Source Code: tsc-watch-hangs.zip

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:33 (16 by maintainers)

github_iconTop GitHub Comments

4reactions
Bnayacommented, Jan 11, 2019

Hey @benjaminjackman @pelotom I’m struggling with similar issues

Something that really helped with spinning up watch is to mask MST models behind interfaces, especially for composited models. (is a similar manner to your examples )

i didn’t check how its effect decelerations emits, just tsc -w startup times (from forever to 10 secs) and im still playing with it.

A quick and minimal example:


export type ForDirectExtend<T> = T;

const MyAModelInferred = types.model("MyAModel", {
  items: types.array(types.string)
});

interface MyAModelType extends ForDirectExtend<typeof MyAModelInferred> {}

// now MyAModel is fast!
const MyAModel: MyAModelType = MyAModelInferred;


// Now even MyBModelInferred is not very slow, becouse its referencing the "fast" MyAModel and not the inferred thing
const MyBModelInferred = types.model("MyBModel", {
  somethingsomething: types.map(MyAModel)
});

interface MyBModelType extends ForDirectExtend<typeof MyBModelInferred> {}

const MyBModel: MyBModelType = MyBModelInferred;

And if we could hint typescript to create intermediate type names instead all of it, that would be great!

3reactions
benjaminjackmancommented, Sep 7, 2018

I made a gist that describes how to use chokidar to call tsc --noEmit whenever a file changes in case anyone stumbles into this ticket:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swift Compilation Hangs on Release Builds - Apple Developer
I'm getting an issue where compiling both my macOS and iOS frameworks in Release modes (i.e., Archive) in Xcode 10.2. This happens with...
Read more >
can't stop compile and then hangs - Visual Studio Feedback
The build cannot be cancelled from VS. VS cannot be closed (because a build is running). We have to use the task manager...
Read more >
webpack --watch isn't compiling changed files - Stack Overflow
The way I resolved the issue was finding a capitalization error in an import path. Folder on file system had lower case first...
Read more >
Fix program errors and improve code - Visual Studio (Windows)
The easiest way to build your project is to press F7, but you can also ... previously and successfully compiled, you probably have...
Read more >
Known issues with Android Studio and Android Gradle Plugin
Native debugger crashes with "Debugger process finished with exit code 127" ... This error occurs on Linux-based platforms when starting the native debugger....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found