What Is MorJS and How It Enables One-Code Multi-Platform Mini‑Program Development
MorJS is an open‑source, extensible framework that lets developers write a single mini‑program using a native DSL and compile it into deployable artifacts for multiple platforms—including WeChat, Alipay, Baidu, ByteDance, DingTalk, Kuaishou, QQ, Taobao, and H5—while offering plugins, form conversion, and H5 integration.
What Is MorJS?
Open‑source address: https://github.com/eleme/morjs
Overview
Mor (pronounced /mɔːr/, like “more”) is an extensible multi‑platform development framework created by Ele.me, built on a mini‑program DSL.
With MorJS you write a single mini‑program (WeChat or Alipay) and, using its cross‑platform compilation capability, generate deployable artifacts for various platforms (WeChat, Alipay, Baidu, ByteDance, DingTalk, Kuaishou, QQ, Taobao, H5). It also supports conversion between mini‑program, mini‑program plugin, and mini‑program sub‑package forms, and provides a full‑stage plugin system for extending functionality and improving development experience.
Example
Below is the performance of Ele.me’s food‑delivery channel in WeChat, Alipay, Douyin mini‑programs and H5.
Why Build MorJS?
Ele.me needed to deliver C‑side business across many mini‑program platforms. Existing solutions could not keep up with growing platform differences, performance overhead, and configuration complexity. MorJS addresses the following requirements:
Native DSL support – easy migration of existing mini‑program code.
Reduced performance overhead – lightweight runtime and faster builds.
One‑click conversion – generate artifacts for all supported platforms.
Extensible functionality – decoupling solutions for large, complex mini‑programs.
Flexible configuration – simple addition or modification of multiple platform configs.
Artifact optimization – compress output and reduce package size.
After confirming these needs, we surveyed existing frameworks and found none that fully satisfied them, so we decided to develop MorJS.
How to Use MorJS?
MorJS extends the native mini‑program DSL; if you know either WeChat or Alipay mini‑program development, you can almost master MorJS.
MorJS provides an official CLI for creating new projects and can also be integrated into existing mini‑programs.
Start a New Project
Project examples: https://github.com/eleme/morjs/tree/main/examples
Create a project in your chosen directory:
$ npm init mor # npm create project
$ yarn create mor # yarn create project
$ pnpm create mor # pnpm create projectSelect the project type and follow prompts to initialize.
✔ Choose project type › Mini‑program
✔ Choose source type › WeChat mini‑program DSL
✔ Use Typescript … No / Yes
✔ Choose CSS pre‑processor › less
✔ Enter mini‑program name … myapp
✔ Enter description … my first app
✔ Username … yourUserName
✔ Email … [email protected]
✔ Git repo … https://github.com/yourUserName/myapp
✔ Choose npm client › npm / pnpm / yarn
…Run the compile command to start the project: $ npm run dev The multi‑platform artifacts are generated in the dist directory; open them with the corresponding IDE for preview.
Integrate into an Existing Mini‑Program
Add required dependencies:
$ npm i @morjs/cli -D && npm i @morjs/core --saveAdd a mor.config.ts file at the project root:
import { defineConfig } from '@morjs/cli'
export default defineConfig([
// First config: WeChat DSL compilation
{
name: 'wx',
sourceType: 'wechat', // source DSL
target: 'wechat', // compile target
compileMode: 'bundle',
},
// Second config: WeChat to Alipay
{
name: 'ali',
sourceType: 'wechat',
target: 'alipay',
compileMode: 'bundle',
},
// Third config: WeChat to Web
{
name: 'web',
sourceType: 'wechat',
target: 'web',
compileMode: 'bundle',
},
])Configure scripts in package.json:
{
"scripts": {
"dev": "mor compile -w",
"build": "mor compile --production"
}
}Run the compile command to start the project: $ npm run dev The built artifacts appear in the dist folder; open them with the appropriate IDE.
Core Capabilities of MorJS
Multi‑Platform Compilation
From the beginning, MorJS enables “one code, many platforms” conversion, producing separate artifacts for each mini‑program platform, dramatically reducing development, recruitment, management, and testing costs. It now supports most major mini‑program platforms.
For details, see “How MorJS Works”.
Integrated Development
As projects grow, they can become large and hard to decouple despite official sub‑package and plugin solutions. MorJS’s integrated development splits host and sub‑modules into independent projects, then merges them through packaging, compilation, and building, delivering a complete mini‑program for development, debugging, and deployment.
See “Complex Mini‑Program Integration”.
Form Conversion
If your project does not need this, you can skip. With increasing deployment scenarios, the same business may need different forms on different platforms (e.g., a sub‑package on WeChat). MorJS provides one‑project conversion among mini‑program, plugin, and sub‑package forms across platforms with minimal code changes.
See “Mini‑Program Form Unity”.
H5 Convergence
MorJS can also convert mini‑program projects to Web (H5) by generating a React‑based output, supporting whole‑project transpilation or single‑component compilation.
See “MorJS Web Development”.
Other Features
Additional ecosystem capabilities include:
Conditional compilation for flexible environment‑specific builds.
Artifact compression with extensible advanced compression options.
Mock capabilities for local JSAPI mocking during development.
…
Advantages and Current Status
Advantages
MorJS is a framework based on mini‑program DSL (Alipay or WeChat). Its ease of use, standardization, and flexibility let developers focus on business logic, reduce R&D and debugging costs, and improve productivity.
Current Usage
To date, MorJS supports four compilation forms (mini‑program, plugin, sub‑package, H5), powering most of Ele.me’s C‑side business across channels. By open‑sourcing MorJS, we aim to share technical details, architecture, and insights with enterprises and developers facing similar multi‑platform needs.
Conclusion
MorJS solves Ele.me’s multi‑platform development challenges, allowing developers to concentrate on product features while minimizing compatibility effort. We welcome the community to contribute and accelerate the evolution of one‑code multi‑platform mini‑program capabilities.
GitHub: https://github.com/eleme/morjs
Official site: https://mor.ele.me/
For issues, join the MorJS community DingTalk group.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
