1# HSP转HAR指导
2HSP存在bundleName和签名的一致性要求,而且在调试阶段需要先安装HSP包,导致多模块集成开发存在很多集成的问题,在此场景下推荐使用HAR包的方式提供能力。本文通过配置项的变更将HSP工程变成HAR工程。
3## HSP转HAR的操作步骤
4
51. 修改HSP模块下的module.json5文件,type字段值修改成har,删除deliveryWithInstall和pages字段。
6    ```json
7    // MyApplication\library\src\main\module.json5
8    {
9        "module": {
10            "name": "har",
11            "type": "har",
12            "deviceTypes": [
13            "default",
14            "tablet",
15            "2in1"
16            ]
17        }
18    }
19    ```
202. 在resource\base\profile文件夹下,删除main_pages.json文件。
21
223. 修改HSP模块的hvigorfile.ts文件,将下面内容替换该文件内容。
23    ```ts
24    // MyApplication\library\hvigorfile.ts
25    import { harTasks } from '@ohos/hvigor-ohos-plugin';
26
27    export default {
28        system: harTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
29        plugins:[]         /* Custom plugin to extend the functionality of Hvigor. */
30    }
31    ```
32
334. 修改HSP模块的oh-package.json5文件,删除packageType配置。
34
355. 修改项目级的配置文件build-profile.json5,在modules模块下找到HSP的配置信息,删除HSP配置下的targets。