天天看点

SAP Spartacus 服务器端渲染返回的源代码不全的问题及解决方案

如下图所示:

我本地启用SSR后,服务器端返回渲染好的源代码里,每个cx-page-layout标签都是空的:

SAP Spartacus 服务器端渲染返回的源代码不全的问题及解决方案
SAP Spartacus 服务器端渲染返回的源代码不全的问题及解决方案

Additionally, it looks like you might have an invalid certificate on the back-end, which causes the angular SSR render to pass (therefore you see the regular non-CMS angular components being rendered), but you won’t see Spartacus’ CMS components being rendered.To go around this in development, you can first install “cross-env” package, and then run “cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node dist/storefrontapp-server/main.js”.After doing all this, you should be able to see the more sensible response.

解决方案:

cross-env NODE_TLS_REJECT_UNAUTHORIZED=0 node dist/storefrontapp-server/main.js