關於 SAP Spartacus 服務器端渲染 SSR fallback 到 CSR 的疑問

I am working on SNOW ticket https://diablo.service-now.com/20210803/workspace/agent/record/sn_customerservice_case/7ef92e151b2db05463bc11718b4bcb08 and would like to reproduce from my side.

  1. I create a new store based on ^3.1.3 ( actual version 3.4.1, found in package-lock.json ) and only enabled B2C feature.

I create a new repo and make initial commit:

https://github.com/wangzixi-diablo/pureb2cstore/commit/3f978420b7a7530aa8f336ef580deaa551e0e3f1

  1. I switch on SSR support via schematics using command line: ng add @spartacus/schematics --ssr

I commit the change: https://github.com/wangzixi-diablo/pureb2cstore/commit/adc308dfdff21079494d6995402502100670470c

  1. I use ng serve to check if CSR still works after SSR is enabled. To my surprise, after SSR is enabled, I found CSR does not work any more, http://localhost:4203/electronics-spa/en/USD/ only shows empty page:

No HTTP error in console.

I know that in certain condition, SSR will fallback to CSR. So I would assume a storefront can still works in CSR mode by default even if it's SSR enabled. Is my understanding correct?

According to our document:

https://sap.github.io/spartacus-docs/3.x/server-side-rendering-in-spartacus/#adding-ssr-support-using-schematics-recommended

use ng add @spartacus/schematics --ssr is enough and no further steps are required.

Do I miss something to make CSR work again after SSR is enabled by Schematics?

更多Jerry的原創文章,盡在:"汪子熙":


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章