3

I just started digging into Angular2. Looks promising at this point. One this I could not find is production deployment best practices or guides (if any). Of course, I could run npm in production and serve the thing through light server, but isn't is best to compile everything for deployment? I am aware that I can precompile everything (even into a single file), but do I need to maintain different entry file for that? (by the way, I tried it and it does not work out of the box).

Any advice?

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Shurik Agulyansky
  • 2,607
  • 2
  • 34
  • 76

1 Answers1

1

Yes, in fact, you can leverage same practices (concat, uglify, html-replace) than for an Angular1 application except for the TypeScript part. Note that I can't unfortunately make work useref in this context...

You need to leverage the TypeScript compiler and its outFile property to compile all your TypeScript files to JavaScript and into a single file that can be uglify then.

See this question for more details:

Community
  • 1
  • 1
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360