
如题

问题场景一:
编译态没问题,使用了自定义参数BuildProfile,编译态无异常但编译构建失败,提示“Property xxx does not exist on type 'typeof BuildProfile'.”。
解决措施:
检查在当前模块下build-profile.json5中的targets > buildProfileFields配置的自定义参数中key值是否相同,如果不同请将targets内所有buildProfileFields中的key值保持相同,如以下示例:
"targets": [
{
"name": "default",
"config": {
"buildOption": {
"arkOptions": {
"buildProfileFields": {
"targetName": "default"
}
}
}
}
},
{
"name": "default1",
"config": {
"buildOption": {
"arkOptions": {
"buildProfileFields": {
"targetName": "default1"
}
}
}
}
},
]
问题场景二:
本地HSP模块对外提供的接口中使用了HAP未定义的自定义参数BuildProfileFileds,且HAP引用了HSP中的该接口,导致编译失败,提示“Property 'XX' does not exist on type 'typeof BuildProfile'”。
解决措施:
可采用以下两种方式解决该问题:
1.在HAP中配置与HSP相同的自定义参数BuildProfileFileds。
2.将与HSP相同的自定义参数BuildProfileFileds配置到工程级build-profile.json5中,该方法会使HSP中的自定义参数在全局生效。
问题场景三:
编译态标红,使用了自定义参数BuildProfile并且代码标红且构建失败,提示“Property xxx does not exist on type 'typeof BuildProfile'.”。
解决措施:
检查当前模块下build-profile.json5中buildProfileFields内是否添加了所使用的自定义参数,确保该自定义参数已配置在buildProfileFields内。
