Ember-cli-typescript: incremental rebuilds do not include updates to .ts files

Created on 11 May 2018  Â·  6Comments  Â·  Source: typed-ember/ember-cli-typescript

Environment

node 8.11.1
ember-cli 3.1.4
ember-cli-typescript: 1.3.0
typescript: 2.8.3

// ember-cli-build.js
'use strict'
const EmberApp = require('ember-cli/lib/broccoli/ember-app')
module.exports = function(defaults) {
  let app = new EmberApp(defaults, {
    hinting: false,
  })
  if (app.env === 'development') {
    app.import('vendor/csp-script-test.js')
  }
  app.import('vendor/google-analytics.js')
  return app.toTree()
}

Problem

When I run DEBUG=ember-cli-typescript* ember serve…

  1. if I change an app/**/*.js file, ember-cli ✅ sees the change, ✅ rebuilds, ✅ tells the browser to refresh, and ✅ responds with the updated /assets/myapp.js.
  2. if I change an app/**/*.ts file, it does all of those steps except the last. That is, the page refreshes, but the compiled JavaScript does not reflect my recent changes.
  3. if I change a .ts file and then a .js file only the .js changes are reflected in myapp.js.
  4. if I change a .ts file and then touch the same file, no changes are reflected in myapp.js.

I get the following debug output when I change app/components/my-component.ts (and when I touch it):

file changed components/my-component.ts
  ember-cli-typescript:compiler-state broccoliDidStart | broccoli: 1 active nodes | tsc: idle (0 errors) +18s
  ember-cli-typescript:compiler-state broccoliDidEnd | broccoli: 0 active nodes | tsc: idle (0 errors) +0ms
  ember-cli-typescript:compiler-state broccoliDidStart | broccoli: 1 active nodes | tsc: idle (0 errors) +209ms
  ember-cli-typescript:compiler-state broccoliDidEnd | broccoli: 0 active nodes | tsc: idle (0 errors) +0ms
  ember-cli-typescript:compiler-state broccoliDidStart | broccoli: 1 active nodes | tsc: idle (0 errors) +1ms
  ember-cli-typescript:compiler-state broccoliDidEnd | broccoli: 0 active nodes | tsc: idle (0 errors) +0ms
  ember-cli-typescript:compiler-state broccoliDidStart | broccoli: 1 active nodes | tsc: idle (0 errors) +339ms
  ember-cli-typescript:compiler-state broccoliDidEnd | broccoli: 0 active nodes | tsc: idle (0 errors) +0ms

On [email protected], I get the same behavior with slightly different logging output:

file changed components/my-component.ts
  ember-cli-typescript:compiler broccoli detected a file change +11s
  ember-cli-typescript:compiler waiting for tsc output {} +0ms
  ember-cli-typescript:autoresolve no tsc rebuild; autoresolving... +32s
  ember-cli-typescript:compiler tsc build complete {} +505ms
  ember-cli-typescript:compiler waiting for tsc output { mirage: 'app/mirage' } +212ms
  ember-cli-typescript:compiler tsc build complete { mirage: 'app/mirage' } +1ms
  ember-cli-typescript:compiler waiting for tsc output { './app': 'app' } +1ms
  ember-cli-typescript:compiler tsc build complete { './app': 'app' } +0ms
  ember-cli-typescript:compiler waiting for tsc output { tests: 'tests' } +604ms
  ember-cli-typescript:compiler tsc build complete { tests: 'tests' } +0ms

Per #158, I've tried VSCode, vi, and touch to modify the file.

Possibly related to #125, #158, #204

All 6 comments

@jamesarosen I had a similar issue with ember b -w reported in #204 I think we may be looking at the same root cause. For me the work around has been to install the 1.3.0-beta.4 release. But I have other issues with ember b -w still, e.g. when changing a branch that removes a .ts file the build goes nuts.

1.3.0-beta.4 acts the same as 1.3.0 for me. (I assume you didn't mean 1.0.3-beta.4, since no such version exists.)

@jamesarosen Interesting... your output here indicates something different than what's going on in #204. There, the file watcher is picking up on the change on disk (the ember-cli-typescript:tsc:trace DirectoryWatcher:: Triggered lines), but tsc is deciding that the corresponding file is uninteresting to it.

Here, there's no DirectoryWatcher:: Triggered output, so the file watcher itself isn't noticing the change. Is there any chance this regex is applying to something in the path where your project lives?

Good intuition! The real path of my app is /Users/jamesrosen/.devly/library/repos/myapp/ The .devly/library/ bit is a required path for one of our in-house tools. I'm asking that team if it can be changed.

Separately, I'd love to investigate whether we can apply that regex only _after_ the app root.

Ok. I'm able to move the project directory, so this is resolved for me.

If it's not easy to start applying that regex _after_ the project root dir, could we add a warning if the project root itself matches that regex? I'm just trying to keep other people from falling into this pit.

Glad that worked! Definitely agreed that this is a gotcha we should avoid—I think we ought to be able to do a better job just ignoring things after the project root.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boris-petrov picture boris-petrov  Â·  7Comments

jamescdavis picture jamescdavis  Â·  5Comments

msz picture msz  Â·  7Comments

mfeckie picture mfeckie  Â·  7Comments

perlun picture perlun  Â·  3Comments