Supported targets
MorJS can compile your mini-program source to the following platforms:| Target | Platform | Global object | Default output |
|---|---|---|---|
alipay | Alipay mini-program | my | dist/alipay |
wechat | WeChat mini-program | wx | dist/wechat |
baidu | Baidu mini-program | swan | dist/baidu |
bytedance | ByteDance (Douyin/Toutiao) | tt | dist/bytedance |
qq | QQ mini-program | qq | dist/qq |
taobao | Taobao mini-program | my | dist/taobao |
dingding | DingTalk mini-program | dd | dist/dingding |
kuaishou | Kuaishou mini-program | ks | dist/kuaishou |
web | Web application (H5) | myPro | dist/web |
Setting the target
In mor.config.ts
mor.config.ts
Via CLI flag
The-t / --target flag overrides the config file value:
Compiling to multiple targets
Pass an array todefineConfig to compile all targets in a single mor compile invocation:
mor.config.ts
--name:
Custom output path
Each target has its own default output directory. Override it per config or on the CLI:Target-specific defaults
Each target automatically sets appropriate compilation defaults:- Module format:
CommonJS - Script target:
ES5 - Templates:
.wxml - Styles:
.wxss - SJS files:
.wxs
Alipay
- Module format:
ESNext - Script target:
ES2015 - Templates:
.axml - Styles:
.acss - SJS files:
.sjs
ByteDance
- Shares Alipay file conventions
- Global object:
tt - Output:
dist/bytedance
Web
- Alipay DSL as base
- Global object:
myPro - Produces a webpack bundle with HTML entry
- See the Web Compilation guide
Conditional file extensions
Each target also sets a default conditional file extension used for file-level conditional compilation:| Target | Default extension |
|---|---|
wechat | .wx |
alipay | .my |
baidu | .swan |
bytedance | .tt |
qq | .qq |
taobao | .tb |
dingding | .dd |
web | .web |
index.wx.ts exists alongside index.ts, MorJS prefers index.wx.ts when compiling to the wechat target.