SAP Spartacus 服务器端渲染文件 server.js 和构建后的 main.js 对比
構(gòu)建之前:
構(gòu)建之后:
其中 express__WEBPACK_IMPORTED_MODULE_3__ 來自 module uX2x:
uX2x 來自 node_modules/express/index.js:
其依賴 K0zx.
SAP Spartacus 服務(wù)器端渲染的一個(gè)局限
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 運(yùn)行在 mobile-first 模式下,意味著有些 UI 不會(huì)得到渲染,因?yàn)?Mobile 和桌面端不同的響應(yīng)式布局策略。
This is a serious limitation for crawlers as they’re not able to index the full content.
對于網(wǎng)絡(luò)爬蟲來說,這是一個(gè)嚴(yán)重的局限,因?yàn)槿绱艘粊?#xff0c;爬蟲無法爬取完整的頁面內(nèi)容。
Especially when the content is important (such as the main navigation).
對于有些重要的內(nèi)容,比如 main navigation,這個(gè)局限性尤其致命。
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 結(jié)構(gòu),而不是 HTML?
The screen-size driven responsive CSS is applied on top of this.
響應(yīng)式 CSS 施加在 DOM 結(jié)構(gòu)上。
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.
帶有導(dǎo)航的 header 渲染結(jié)果有所差異。
Normally you would not experience this in the browser, because whenever resizing the browser, the DOM got re-rendered.
瀏覽器里,每次調(diào)整其尺寸,DOM 都會(huì)重新渲染。
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的原創(chuàng)文章,盡在:“汪子熙”:
總結(jié)
以上是生活随笔為你收集整理的SAP Spartacus 服务器端渲染文件 server.js 和构建后的 main.js 对比的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: FLASH如何做等高线原理演示课件
- 下一篇: SAP Spartacus 服务器端渲染