Angular Universal:如何创建一个app shell并且只预呈现shell?

问题描述 投票:1回答:1

背景

为了加快我的角度7应用程序的感知性能,我试图在我的应用程序中添加一个app shell,并使用angular universal预呈现该shell。为此,我正在关注这些steps

问题

当我从上面的链接(ng run my-app:app-shell)执行步骤3中的命令时,该过程失败,因为看起来angular universal正在尝试使用节点环境构建我的整个应用程序,并且我的应用程序的某些部分与角度不兼容普遍。我不需要渲染整个应用程序或与angular universal兼容,只需要app shell组件。

问题

  1. 如何在ng run my-app:app-shell命令中仅包含要预渲染的应用程序shell?
  2. 此外,该命令在开发模式下构建应用程序的其余部分。如何触发prod构建?
angular typescript serverside-rendering angular-universal
1个回答
0
投票

回答你的第二个问题。我在这里找到了答案:https://github.com/angular/angular-cli/issues/11478#issuecomment-423825620

ng run my-app:app-shell -c production
© www.soinside.com 2019 - 2024. All rights reserved.