Okam Build
raw JSON → 0.4.27-alpha.0 verified Sat May 09 auth: no javascript
Build tool for Okam framework targeting Chinese mini-program platforms (Baidu Smart Mini Programs and WeChat Mini Programs). Current version 0.4.27-alpha.0, alpha release. Provides optimized builds for mini-program development with proper tree-shaking and bundling. Key differentiators: dedicated to Okam framework, supports multi-platform mini-program builds (Baidu, WeChat)
Common errors
error Error: Cannot find module 'okam-core' ↓
cause okam-core peer dependency not installed
fix
npm install okam-core
error TypeError: build is not a function ↓
cause Wrong import method (ESM import instead of require)
fix
Change import to const { build } = require('okam-build')
error Error: Invalid platform type 'wx' ↓
cause Unsupported or misspelled platform
fix
Use valid platform: 'swan' for Baidu, 'wx' for WeChat is not supported (use 'wechat')
Warnings
gotcha Use require(), not ESM imports ↓
fix Use const { build } = require('okam-build') instead of import statements.
breaking API change in version 0.4.x: build function parameters restructured ↓
fix Check documentation for correct configuration object shape; old positional arguments removed.
deprecated Support for older platform versions is deprecated ↓
fix Use latest platform SDKs (e.g., Baidu Swift 3.0+).
Install
npm install okam-build yarn add okam-build pnpm add okam-build Imports
- build wrong
import { build } from 'okam-build'correctconst { build } = require('okam-build') - createApp wrong
const createApp = require('okam-build').createAppcorrectconst { createApp } = require('okam-build') - default wrong
import okamBuild from 'okam-build'correctconst okamBuild = require('okam-build')
Quickstart
const { build } = require('okam-build');
build({
type: 'swan',
root: './src',
output: './dist',
config: {
projectConfig: {
appid: process.env.APPID ?? ''
}
}
}).then(() => {
console.log('Build complete');
}).catch(err => {
console.error('Build failed', err);
});