目录

Preloading

Preloading enables the system to automatically download and install required subpackage modules, speeding up the access to subsequent modules.

For subpackage modules configured with preloading, the system triggers preloading of associated modules after the user clicks a module and its page loading is complete.

NOTE

In the preloads list, the value of ModuleType corresponding to moduleName cannot be entry.

You can configure the preloads field under atomicService in the module.json5 file of the specified subpackage module. The following uses module.json5 of the entry module as an example:

{  
  "module": {
    "name": "entry",
    "type": "entry",
    "installationFree": true,
    "pages": "$profile:main_pages",
    "atomicService": {
      "preloads": [
        {
          "moduleName": "library"
        }
      ]
    },
    ...
  }
}

After the page of the entry module is loaded, the system automatically performs preloading to download and install the library module.