且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-09-04 19:07:51

如下图所示:

我本地启用s-s-r后,服务器端返回渲染好的源代码里,每个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 s-s-r 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