SAP Spartacus 服务器端渲染文件 server.js 和构建后的 main.js 对比
構建之前:
構建之后:
其中 express__WEBPACK_IMPORTED_MODULE_3__ 來自 module uX2x:
uX2x 來自 node_modules/express/index.js:
其依賴 K0zx.
SAP Spartacus 服務器端渲染的一個局限
The SSR process is currently running in mobile-first mode, which means that some parts of the UI are not rendered because of the adaptive layout of mobile vs desktop.
目前 SAP Spartacus SSR 運行在 mobile-first 模式下,意味著有些 UI 不會得到渲染,因為 Mobile 和桌面端不同的響應式布局策略。
This is a serious limitation for crawlers as they’re not able to index the full content.
對于網絡爬蟲來說,這是一個嚴重的局限,因為如此一來,爬蟲無法爬取完整的頁面內容。
Especially when the content is important (such as the main navigation).
對于有些重要的內容,比如 main navigation,這個局限性尤其致命。
slots that are not displayed in mobile are not rendered in SSR.
Our SSR (nowadays at least) only exposes the DOM structure, no HTML.
只暴露 DOM 結構,而不是 HTML?
The screen-size driven responsive CSS is applied on top of this.
響應式 CSS 施加在 DOM 結構上。
There is however a very small piece in Spartacus that renders a different DOM based on the device/screen-size, which is caused by the LayoutConfig: the header with the navigation will be rendered differently.
帶有導航的 header 渲染結果有所差異。
Normally you would not experience this in the browser, because whenever resizing the browser, the DOM got re-rendered.
瀏覽器里,每次調整其尺寸,DOM 都會重新渲染。
In this case however, the SSR response will not be re-rendered as long as the user doesn’t change the screen size. If the user just loads the SSR response, it will likely only show the mobile DOM, with the desktop CSS.
更多Jerry的原創文章,盡在:“汪子熙”:
總結
以上是生活随笔為你收集整理的SAP Spartacus 服务器端渲染文件 server.js 和构建后的 main.js 对比的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FLASH如何做等高线原理演示课件
- 下一篇: SAP Spartacus 服务器端渲染