Angular migration 14 to 15 / 16: Has angular universal ceased to put <!– this page was prerendered with angular universal –> for pre-rendered pages?

huangapple go评论55阅读模式
英文:

Angular migration 14 to 15 / 16: Has angular universal ceased to put <!-- this page was prerendered with angular universal --> for pre-rendered pages?

问题

我最近从 Angular 的 14 版迁移到了 15 版(然后升级到 16 版),使用 Angular Universal 进行预渲染似乎发生了变化:它仍然 似乎 能够正常工作,但熟悉的 &lt;!-- this page was prerendered with angular universal --&gt; 已经消失了。

问题:
我是否不再依赖添加的 HTML 注释来快速验证预渲染和服务器端渲染是否正常工作?也就是说,它已经不存在了吗?
如果是,为什么?为什么我在网上找不到任何信息?
如果不是,迁移期间我可能破坏了什么,导致它不再显示?

英文:

I recently migrated from version 14 of angular to version 15 (and then to 16) and pre-rendering with angular universal seems to have changed: It still seems to work afaict but the familiar &lt;!-- this page was prerendered with angular universal --&gt; has gone.

Questions:
Can I no longer rely on the added html-comment to quickly verify, prerendering and ssr is working? i.e. is it gone?
If yes, why and why can I not find anything online?
If no, what might I have broken during migration that killed it?

答案1

得分: 4

自 v15 起,在内容由 universal 生成时,您的 DOM 中会有 ng-server-context

当内容动态生成时,可能是:

  • ng-server-context=&quot;ssr&quot;
  • ng-server-context=&quot;ssg&quot; 当内容正在进行预渲染(静态站点生成)
英文:

Since v15, you have ng-server-context in your DOM when the content has been generated by universal.

You would either have :

  • ng-server-context=&quot;ssr&quot; when the content is generated dynamically
  • ng-server-context=&quot;ssg&quot; when the content is being prerendered (static site generation)

huangapple
  • 本文由 发表于 2023年5月14日 01:18:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76244036.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定