Ember-cli-typescript: Incremental compilation problems

Created on 14 Feb 2018  Â·  7Comments  Â·  Source: typed-ember/ember-cli-typescript

We tried to upgrade ember-cli-typescript in our app from 1.0.6 to 1.1.1, excited to try out incremental compilation. However, we discovered it actually broke the build process for us.

For starters, ember build also seems to run tsc in watch mode, because it produces the following message:

14:53:14 - Compilation complete. Watching for file changes.

I assume this is not intended?

Secondly, in most cases, tsc seems to pick up several file changes right after "Compilation complete", and then the build essentially hangs indefinitely. Example:

14:53:14 - Compilation complete. Watching for file changes.
14:53:19 - File change detected. Starting incremental compilation...
14:53:20 - File change detected. Starting incremental compilation...
14:53:20 - File change detected. Starting incremental compilation...
14:53:21 - File change detected. Starting incremental compilation...
14:53:22 - File change detected. Starting incremental compilation...
14:53:24 - File change detected. Starting incremental compilation...
14:53:24 - File change detected. Starting incremental compilation...

On our CI server (CircleCI), no file changes are picked up and that's probably why the build is actually able to finish successfully there. File changes hang the build on several development machines and on Heroku though.

Any idea how to debug/fix this?

All 7 comments

Thanks for the report, @msz!

We're currently invoking tsc in watch mode for all of our invocations – in part because as far as we can see Ember CLI doesn't really give us good, public API hooks to tell whether _it_ is being invoked in watch mode or not. We're looking at ways to work around that, but we hadn't bumped into this in our pre-release testing. 😬

The watch-mode invocation should be the same if no files change, so the surprising thing here is that it is detecting file changes; but if we could just do a non---watch build, that would also presumably help.

cc. @Turbo87 @rwjblue

@msz can you share the contents of your tsconfig.json? Did you regenerate it when you upgraded ember-cli-typescript?

Thanks for the lightning fast response!

Regenerating tsconfig.json helped! It seems the problem was that instead of an include section we had an exclude section with the following contents:

  "exclude": [
    "tmp",
    "dist",
    "node_modules",
    "bower_components"
  ]

so I guess this was not strict enough and caught some files outside of the paths necessary for compilation.

Thanks again!

Glad that worked! It generally seems that tsc's watcher is better at excluding things when you, well, don't actually use excludes 😄

Howdy. I came here with the exact same issue, across multiple versions of ember-cli-typescript (as I just upgraded from 1.0.5 to 1.2.1). Removing excludes from tsconfig.json seems to have been enough to fix the problem. Do newer projects setup with latest ember-cli-typescript have this config in the generated tsconfig? It seems like it should not (or perhaps never has? I don't think I added this setting myself, but I may be wrong).
It seems like there is some potential documentation that needs to be done to inform people of a potential issue around this? Potentially by people adding excludes themselves or old excludes values laying around from older versions of ember-cli-typescript

A much older version of the blueprint – before @dwickern figured out the issue with much experimentation and travail – did indeed include it; that’s presumably where you got it from. I’m adding a note to #170, so that as we go after improving the docs sometime soonish we’ll include a note about this. Thanks!

That makes sense, thanks Chris.

Was this page helpful?
0 / 5 - 0 ratings