Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incremental rebuilds do not include updates to .ts files #206

Closed
jamesarosen opened this issue May 10, 2018 · 6 comments · Fixed by #208
Closed

incremental rebuilds do not include updates to .ts files #206

jamesarosen opened this issue May 10, 2018 · 6 comments · Fixed by #208

Comments

@jamesarosen
Copy link

jamesarosen commented May 10, 2018

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 ember-cli-typescript@1.2.1, 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

@pixelhandler
Copy link

pixelhandler commented May 10, 2018

@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.

@jamesarosen
Copy link
Author

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.)

@dfreeman
Copy link
Member

@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?

@jamesarosen
Copy link
Author

jamesarosen commented May 11, 2018

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.

@jamesarosen
Copy link
Author

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.

@dfreeman
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants