英文:
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 进行预渲染似乎发生了变化:它仍然 似乎 能够正常工作,但熟悉的 <!-- this page was prerendered with angular universal -->
已经消失了。
问题:
我是否不再依赖添加的 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 <!-- this page was prerendered with angular universal -->
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="ssr"
ng-server-context="ssg"
当内容正在进行预渲染(静态站点生成)
英文:
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="ssr"
when the content is generated dynamicallyng-server-context="ssg"
when the content is being prerendered (static site generation)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论