KISSY Module Compiler (kmc)
raw JSON → 1.2.2 verified Fri May 01 auth: no javascript maintenance
A Node.js-based module bundler for KISSY framework, supporting KISSY 1.2+. Current stable version 1.2.2 (last release). It provides config API similar to KISSY's browser-side config, supports mixed encoding (e.g., GBK output), automatic combo for KISSY 1.3, dependency analysis, and regex-based module name mapping. Alternatives include the official Java-based KISSY build tool and grunt-kmc. Release cadence is low; no updates since 2015.
Common errors
error Cannot find module 'kmc' ↓
cause Package not installed or not required correctly.
fix
Run 'npm install kmc' and use 'const kmc = require('kmc');'
error Error: ENOENT: no such file or directory, open '...' ↓
cause Source or destination path is incorrect or not absolute.
fix
Use absolute paths for src and dest in kmc.build().
error TypeError: kmc.build is not a function ↓
cause Incorrect import method (e.g., ES import) or using an older version.
fix
Use 'const kmc = require('kmc');' and ensure version >=1.0.0.
Warnings
gotcha All paths must be absolute; relative paths will cause unexpected behavior. ↓
fix Use path.resolve(__dirname, 'relative/path') to convert to absolute paths.
gotcha The package expects Node.js >=0.10.0 (pre-ES6). It may not work on modern Node versions without compatibility shims. ↓
fix Use a Node version manager (e.g., nvm) with Node 10 or lower, or consider alternative bundlers like Webpack.
gotcha kmc.config() without arguments returns the current config; it does not reset the config. Call kmc.clean() first if you need to clear. ↓
fix Use kmc.clean() before calling kmc.config() with new settings.
gotcha Suffix configuration in kmc.config does not include a dot; e.g., use '.combine' not 'combine'. ↓
fix Set suffix: '.combine' (including the dot).
Install
npm install kmc yarn add kmc pnpm add kmc Imports
- kmc wrong
import kmc from 'kmc';correctconst kmc = require('kmc');
Quickstart
const kmc = require('kmc');
kmc.config({
packages: [{
name: 'myapp',
path: '/absolute/path/to/myapp',
charset: 'utf-8'
}]
});
kmc.build({
src: '/absolute/path/to/myapp/src/main.js',
dest: '/absolute/path/to/myapp/build/main.combine.js',
outputCharset: 'utf-8'
});
console.log('Build completed.');