Read the original article:.ohpmignore file not working
.ohpmignore file not working
Problem Description
Given an .ohpmignore file in the module directory with the content "./src/main//.md", aiming to exclude the md files in the code directory during packaging. However, it is found that the .md files were not filtered out during the build process, and they still exist in the decompressed module. How can we exclude the./src/main/*/.md files in the project during packaging?
Background Knowledge
Troubleshooting Process
The configuration in the.ohpmignore file is only supported when building in debug mode; it is not supported for bytecode HAR or release mode builds.
If you want to exclude certain files during bytecode HAR or release mode builds, you need to add the corresponding configuration in the module-level build-profile.json5 file.
Solution
Add the copyCodeResource configuration information under the buildOption option in the module-level build-profile.json5 file.
An example of the modification in the module-level build-profile.json5 file is as follows:
{
'''
"buildOption": {
"resOptions": {
"copyCodeResource": {
"enable": true,
"excludes": ["./src/main/ets/utils/test.ets"]
}
}
},
...
}
Top comments (0)