【问题标题】:What's the main purpose of platform-server module in Angular 2?Angular 2 中平台服务器模块的主要用途是什么?
【发布时间】:2017-03-06 12:39:22
【问题描述】:

在查看 AOT(提前编译)文档 https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#compile 时,对 platform-server 有依赖,它的目的是什么?似乎只需要运行编译器工具的compiler-cli

【问题讨论】:

    标签: angular typescript platform-server


    【解决方案1】:

    @angular/platform-server 提供支持运行时编译器的服务器平台,它仅作为 compiler-cli 的依赖项。将来,我们将安装不需要它的编译器 cli 为here

    【讨论】:

      【解决方案2】:

      这个问题与 Angular V2 有关,但现在 Angular V4.0.0 几乎发布了(在撰写本文时它是在 RC-3 中)并且@Angular/platform-server 发生了很大变化

      仅供参考

      基于此链接: https://github.com/angular/angular/issues/13822

      Angular Universal 的某些部分(API 部分)被合并到 @angular/Core 另一部分现在改名为@angular/platform-server

      正如@mikezks 在该主题中提到的那样 https://github.com/angular/angular/issues/13822#issuecomment-286742244 所有的魔法都是 renderModuleFactory(这就是 SSR 背后的全部魔法)。

      从现在开始:@angular/platfomr-server 用于 Angular 的服务器端渲染和生成 HTML 页面(在 NodeJS 中)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-31
        • 2015-02-13
        • 2016-01-10
        • 2016-11-19
        • 2010-09-21
        • 2010-10-17
        • 1970-01-01
        相关资源
        最近更新 更多