Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enable SAP Spartacus server-side rendering mode

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article shows you how to enable SAP Spartacus server-side rendering mode, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.

In Spartacus, server-side rendering allows you to render a static version of the page on the server side. This speeds up response time, helps with SEO, and allows applications to render faster. After Angular starts, the users of your site will have a complete experience.

A static version of the server-side rendered page. Server-side rendering (Server Side Rendering,SSR) speeds up the response of applications and contributes to page SEO- search engine optimization.

How to enable Spartacus SSR

The recommended way to add SSR support to Spartacus applications is to use schematics. With just one command, all necessary files will be added automatically, and all changes supported by SSR will be automatically completed. To add SSR support to the Spartacus application, run the following command:

Ng add @ spartacus/schematics-- ssrInstallation Steps for Spartacus Development

Set the occBaseUrl in environment.prod.ts:

Turn off PWA:

Once Spartacus is installed in PWA mode, a service worker is installed, which provides a cached version of index.html along with the js file. This causes the SSR to be skipped completely. The following steps describe how to close PWA.

In app.module.ts, close pwa:

Yarn build:core:lib

Building Angular package

Compiling TypeScript sources through ngc

Bundling to FESM2015

Spartacus/core built over.

Angular package built over.

The built output is located under the projects/core and dist/core folders:

Storefrontlib build completed:

Organization/Administration/core built completed:

A total of 400 seconds

Then: Build your local Spartacus shell app by running the following command:

Yarn build-prod

In fact, the commands executed are:

Ng build storefrontapp-prod-prod

A total of 215 seconds:

Build the SSR version of your shell app by running the following command:

Yarn build:ssr

The end of 72 seconds:

The last step:

Yarn serve:ssr

It turned out to be node express server.

The above content is how to enable SAP Spartacus server-side rendering mode, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 293

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report