13

When looking AOT (ahead of time compilation) docs https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#compile , there is a dependency on platform-server , what is the purpose of it ? seems only compiler-cli required to run the compiler tool

Alireza
  • 100,211
  • 27
  • 269
  • 172
asotog
  • 225
  • 2
  • 8

2 Answers2

15

The @angular/platform-server provides the server platform that supports the runtime compiler and it only as a dependency of compiler-cli. In the future, we will be installing compiler-cli that don't need it as here.

Ha Hoang
  • 1,644
  • 12
  • 14
7

This question is related to Angular V2 but now Angular V4.0.0 Almost release (in the time of writing it is in RC-3) and @Angular/platform-server changed a lot

So Just for the reference

based on this link: https://github.com/angular/angular/issues/13822

some part of Angular Universal(API part) is merged to @angular/Core some another part is now rewritten with the name of @angular/platform-server

an as @mikezks mentioned on that topic https://github.com/angular/angular/issues/13822#issuecomment-286742244 all the magic is renderModuleFactory (that is the whole magic behind SSR).

so from now: @angular/platfomr-server is for server side rendering of Angular and generating HTML pages(in NodeJS)

Alireza
  • 100,211
  • 27
  • 269
  • 172
Mahmood Sajjadi
  • 422
  • 5
  • 12