Skip to main content
The mor CLI is the primary interface for compiling, composing, scaffolding, and analyzing mini-programs with MorJS. Install it globally with:
npm install -g @morjs/cli
Verify the installation:
mor --version

Available commands

compile

Compile a mini-program project to one or more target platforms. Supports bundle and transform modes, watch mode, production builds, and --mock for development mocking.

compose

Integrate multiple subpackages and host apps into a single mini-program output directory.

generate

Scaffold new pages or components using built-in or custom templates. Usage: mor generate <type> [...args]. Alias: mor g.

init / create

Initialize a new MorJS project from a template. Usage: mor init [projectDir]. Alias: mor create. You can also use npx create-mor.

analyze

Analyze bundle size using webpack-bundle-analyzer. Usage: mor analyze.
There is no standalone mor mock command. Mocking is enabled by passing --mock to mor compile during development. See the compile reference for details.

Global flags

--help
boolean
Display help information for the current command. Run mor --help for the top-level help, or mor <command> --help for command-specific help.
--version
boolean
Print the installed version of @morjs/cli and exit.
--verbose
boolean
Enable detailed framework debug logging. Equivalent to setting the DEBUG=mor,mor:* environment variable.

Exploring help

Run any command with --help to see all accepted flags and their descriptions:
# Top-level help
mor --help

# Command-specific help
mor compile --help
mor compose --help
mor analyze --help

Configuration file

All commands read configuration from mor.config.ts (or .js, .mjs, .json) in your project root. You can export a single config object or an array of configs when targeting multiple platforms simultaneously.
mor.config.ts
import { defineConfig } from '@morjs/cli'

export default defineConfig({
  name: 'wechat-build',
  sourceType: 'wechat',
  target: 'wechat',
  compileMode: 'bundle'
})
Use defineConfig from @morjs/cli for full TypeScript type checking on your configuration.

Configuration reference →

Full documentation for mor.config.ts, including all supported fields and export formats.

Build docs developers (and LLMs) love