Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot, maven, AngularJS 2, typescript and live reload

I am in a study phase for an application development. The server-side development has already started, with Spring boot and Maven. Now, I am studying the possible options to develop the client-side.

I'd like to use Angular 2 (I know it's still in alpha), but I'm really hesitating between its javascript and typescript version. I know the live reload with javascript version should work well with maven spring-boot run (in theory), and this is a great help for productivity. I was wondering if there was a way to have the live reload for typescript version of Angular too. Has anyone managed to implement it in its own project? If yes, how did you do?

I have not found any doc about this on maven-typescript-plugin

The build system will be Maven for client side too.

EDIT: Is there an easy way for typescript debugging, or is it a pain?

like image 305
Rémi Doolaeghe Avatar asked Oct 26 '15 15:10

Rémi Doolaeghe


1 Answers

One way could be adding a watch to automatically be triggered on any file change. For example, try adding the following to your package.json file:

{
  "scripts": {
    "tsc": "tsc -p src -w"
  }
}

As the Quickstart for Angular 2 (literally) states that this will be activated when you open a terminal window in the root of the application folder and enter:

npm run tsc

The script sets the compiler watch option (-w) so the compiler stays alive when it's finished. It watches for changes to .ts files and recompiles them automatically.

Considering this will spit out plain-old .js files, you can use the tooling you're comfortable with to reload the page.

like image 85
Juliën Avatar answered Nov 10 '22 10:11

Juliën