在使用本文章介绍的步骤进行SAP Spartacus Storefront在服务器端渲染模式(SSR)下的调试之前,请您确保已经按照如下帮助文档的介绍,已经成功启用了服务器端渲染:
https://sap.github.io/spartacus-docs/server-side-rendering-in-spartacus/并且成功通过下列命令行启动了Spartacus Storefront:
node dist/standalone/server/main.js

本文介绍SAP Spartacus Storefront工作于服务器端渲染模式下时,如何对其进行调试:
Ctrl+Shift+D, 打开Visual Studio Code的调试面板:
我们建议永远不要缓存包含用户数据的页面,甚至不要在 SSR 中渲染它们。 默认情况下,在 SSR 中呈现的页面始终呈现为匿名用户,因此它们不包含任何用户数据。 这是因为用户令牌仅在客户端,从未传递给 SSR 服务器。