1# Converting HAR to HSP
2Currently, the HAR has a problem with duplicate packaging, leading an oversize application package. To fix this problem, the HSP is an ideal choice. This topic describes how to convert the HAR to the HSP.
3## How to Convert
4
51. Modify the **module.json5** file of the HAR module.
6    ```json
7    // MyApplication\library\src\main\module.json5
8    {
9      "module": {
10        "name": "library",
11        "type": "shared",
12        "description": "$string:shared_desc",
13        "deliveryWithInstall": true,
14        "pages": "$profile:main_pages"
15      }
16    }
17    ```
18
192. Add a string field **shared_desc** in **resources** > **base** > **element** of **en\_US** and **zh\_CN** qualifiers directories.
20    ```json
21    // MyApplication\library\src\main\resources\base\element\string.json
22    {
23      "string": [
24        {
25          "name": "shared_desc",
26          "value": "description"
27        }
28      ]
29    }
30    ```
31
323. Add a **profile** folder in **resources** > **base**. Then add a **main_pages.json** file to the **profile** folder and configure the file.
33    ```json
34    // MyApplication\library\src\main\resources\base\profile\main_pages.json
35    {
36      "src": [
37        "pages/PageIndex"
38      ]
39    }
40    ```
41
424. Add a **pages** directory in the **ets** directory. Then add a **PageIndex.ets** file in the **pages** directory.
43    ```ts
44    // MyApplication\library\src\main\ets\pages\PageIndex.ets
45    @Entry
46    @Component
47    struct PageIndex {
48      @State message: string = 'hello world';
49
50      build() {
51        Row() {
52          Column() {
53            Text(this.message)
54              .fontSize(50)
55              .fontWeight(FontWeight.Bold)
56          }
57          .width('100%')
58        }
59        .height('100%')
60      }
61    }
62    ```
63
645. Delete the **consumerFiles** field from **MyApplication** > **library** > **build-profile.json5** file.
65
666. Modify the **hvigorfile.ts** file.
67    ```ts
68    // MyApplication\library\hvigorfile.ts
69    import { hspTasks } from '@ohos/hvigor-ohos-plugin';
70
71    export default {
72      system: hspTasks,  /* Built-in plugin of Hvigor. It cannot be modified. */
73      plugins:[]         /* Custom plugin to extend the functionality of Hvigor. */
74    }
75    ```
76
777. Modify the **oh-package.json5** file and configure the **packageType** field.
78    ```json
79    // MyApplication\library\oh-package.json5
80    {
81      "packageType": "InterfaceHar"
82    }
83    ```
84
858. Modify the **build-profile.json5** configuration file in the root directory.
86![har-to-hsp-8-1.png](figures/har-to-hsp-8-1.png)
87After modification
88![har-to-hsp-8-2.png](figures/har-to-hsp-8-2.png)
89