lbialy / play-ng2-webpack2

Play 2.6.0 + Angular with Angular-CLI + SBT - based build
Other
55 stars 20 forks source link

Play refresh angular content #4

Closed javierfvargas closed 7 years ago

javierfvargas commented 7 years ago

Documentation states "Changes in ui folder don't cause Play reloads, but are observed (and handled) by Angular-CLI when Play is running in dev mode", however if I change something at ui I have to touch e.g. application.conf to get the change visible in my app.

Am I doing something wrong? How is your experience with this?

lbialy commented 7 years ago

Apparently this should work as advertised: UIBuild.scala:

override def afterStarted(addr: InetSocketAddress): Unit = {
  process = Option(
    Process("npm run build -- --watch", base / "ui").run
  )
}

Problem might be related to Play server not refreshing the asset after it's rebuilt by ng2's watcher process. I'll investigate.

lbialy commented 7 years ago

Confirmed, Play is not reloading when unmanaged resource is changed. I'll see what I can do about this. For now I advise running angular 2 via ng serve when possible.

lbialy commented 7 years ago

Ok, fixed to some extent (--aot can't be used with ng build -w yet: https://github.com/angular/angular-cli/issues/5137). This will be included in today's update, but it comes with several changes and update to angular cli and angular itself, sorry.