No Component-preload.js generation for SAP Fiori Library Components (SAP Web IDE)

Problem

If you create an SAP Fiori Library in the SAP Web IDE you may have problems with the build process. It doesn’t create Component-preload.js files for your different components in the library and it also may not create an library-preload.js file.

Assumption

You didn’t changed the following files:

  • Gruntfile.js
  • ui5.yaml
  • package.json

Solution

First adapt the ui5.yaml file. Add the build option componentPreload to your ui5.yaml file and define the different namespaces containing the components. (For more information see UI5 Tooling – Configuration – Component Preload Generation)

builder:
  componentPreload:
    namespaces:
      - "sample/lib/components/a"
      - "sample/lib/components/b"
      - "sample/lib/components/c"

After that adapt your package.json. Add the standard task generateComponentPreload to the build command. (For more information see UI5 Tooling – Builder – Standard Tasks)

    "scripts": {
        ...
        "build": "ui5 build --include-task=generateManifestBundle generateCachebusterInfo generateComponentPreload ",
        ...
    }

There you go. When you build or deploy your library the next time the Gruntfile.js will execute the npm run build-for-deploy command that will call the changed build command of your package.json.

Leave a Reply

Your email address will not be published. Required fields are marked *