目录

How do I convert a HAR to an HSP?

Converting a HAR to an HSP is primarily achieved by modifying the relevant configuration files. The procedure is as follows:

  1. In the module.json5 file of the HAR, change the value of the type field to shared and set the deliveryWithInstall field to true.
  2. If the HSP needs to declare navigable pages, add a pages field in the module.json5 file. Then, create a profile/main_pages.json file in the resources/base directory and set the src field.
  3. In the hvigorfile.ts file of the HAR, change harTasks to hspTasks.
  4. In the build-profile.json5 file of the HAR, remove the consumerFiles field, which is generated by default and specifies the default obfuscation rules.

After the configuration is modified, recompile the code.