Setting Client-Side Rendering Web Root Path

Set the web root path for client-side rendering.

Context

With client-side rendering (CSR), websites are rendered in a browser and not on the server side. As a result, the web server responds to connection requests by sending lightweight HTML responses that contain JavaScript code. The browser creates the content by rendering the code on the client side and presenting it on the web page.

When using CSR, make sure that the size of each HTTP header that you have defined in your HTML files doesn't exceed the limit of 125 KB.

Procedure

  1. Add the following lines to the js-storefront/manifest.json file:
    {
      "applications": [
          {
              "name": "<your storefrontapp name>",
              "path": "<your storefrontapp path>",
              "csr": {
                    "webroot": "dist/<your storefrontapp name>/browser/"
              }
          }
      ]
    }

    The value of the csr.webroot object should correspond to what is set in projects.<application_name>.architect.build.options.outputPath in the angular.json file.

  2. Log in to the Cloud Portal to create and deploy a build for the storefront.

Results

All files specified in the webroot path are deployed. To troubleshoot any issues, search for jsapps logs in Kibana.