Kuikly Ohos Compile Plugin
raw JSON → 0.0.1-alpha.7 verified Fri May 01 auth: no javascript
A plugin for unified compilation with Android Studio and DevEco Studio in Kuikly projects. Current version is 0.0.1-alpha.7, alpha status with no fixed release cadence. Key differentiators: integrates Kuikly project compilation into Ohos (OpenHarmony) build pipeline, supports copying assets and configuring native library paths. Low-level tooling, requires manual plugin registration and local.properties configuration.
Common errors
error Cannot find module 'kuikly-ohos-compile-plugin' ↓
cause Ohos project not configured with npm registry in .ohpmrc or dependency not added.
fix
Add 'kuikly-ohos-compile-plugin': 'latest' to hvigor/hvigor-config.json5 dependencies and set registry in .ohpmrc.
error Property 'kuikly.projectPath' not set ↓
cause Missing mandatory local.properties entries.
fix
Add kuikly.projectPath, kuikly.moduleName, and kuikly.ohosGradleSettings to local.properties.
error TypeError: kuikly_ohos_compile_plugin_1.kuiklyCompilePlugin is not a function ↓
cause Using wrong import style or incorrect symbol name.
fix
Use import { kuiklyCompilePlugin } from 'kuikly-ohos-compile-plugin' and call it as kuiklyCompilePlugin().
Warnings
deprecated Plugin configuration uses local.properties which may be deprecated in future Hvigor versions. ↓
fix Monitor Hvigor updates and migrate to new configuration format if provided.
breaking Alpha version potentially breaking changes without migration guides. ↓
fix Pin to a specific version and test upgrades thoroughly.
gotcha Requires registry=https://registry.npmjs.org/ in .ohpmrc for dependency resolution. ↓
fix Ensure .ohpmrc contains the correct registry entry.
gotcha Mandatory local.properties keys: kuikly.projectPath, kuikly.moduleName, kuikly.ohosGradleSettings. Missing these causes build failure. ↓
fix Add all required properties to local.properties.
gotcha Plugin functions must be called (e.g., kuiklyCompilePlugin()) not passed as references. ↓
fix Add parentheses: kuiklyCompilePlugin() instead of kuiklyCompilePlugin.
Install
npm install kuikly-ohos-compile-plugin yarn add kuikly-ohos-compile-plugin pnpm add kuikly-ohos-compile-plugin Imports
- kuiklyCompilePlugin wrong
const { kuiklyCompilePlugin } = require('kuikly-ohos-compile-plugin');correctimport { kuiklyCompilePlugin } from 'kuikly-ohos-compile-plugin'; - kuiklyCopyAssetsPlugin wrong
import kuiklyCopyAssetsPlugin from 'kuikly-ohos-compile-plugin';correctimport { kuiklyCopyAssetsPlugin } from 'kuikly-ohos-compile-plugin'; - default export wrong
import KuiklyPlugin from 'kuikly-ohos-compile-plugin';correctNot available; use named exports.
Quickstart
// In hvigorfile.ts of ohos project entry module
import { kuiklyCompilePlugin, kuiklyCopyAssetsPlugin } from 'kuikly-ohos-compile-plugin';
export default {
// ... other config
plugins: [
kuiklyCompilePlugin(),
kuiklyCopyAssetsPlugin({ assetsPath: process.env.KUIKLY_ASSETS_PATH ?? '/path/to/assets' })
]
};