WeChat MiniGame
Estella exports the same project to WeChat MiniGames. You export the game from the editor and open the result in WeChat DevTools.
Build the engine for WeChat
Section titled “Build the engine for WeChat”The editor download already carries the WeChat engine and its side modules, so an
installed editor needs none of this. In an engine source checkout, build them once.
The WeChat target compiles the C++ core with WeChat’s WXWebAssembly shims:
node build-tools/cli.js build -t wechat# side modules, only if your game uses them:node build-tools/cli.js build -t physics-wechat # physicsnode build-tools/cli.js build -t spine-wechat # Spine (builds 2.1 + 3.8 + 4.1 + 4.2 + 4.3)node build-tools/cli.js build -t dragonbones-wechat # DragonBonesnode build-tools/cli.js build -t basis-wechat # KTX2 / compressed texturesnode build-tools/cli.js build -t videodec-wechat # video (MPEG-1 wasm decoder)Export from the editor
Section titled “Export from the editor”-
In Settings → Project → Build and modules → Packaging → WeChat, set your AppID. Screen orientation is project-wide — set it once in Settings → Project → Game → Display → Orientation (it drives the
game.jsondeviceOrientationbelow). -
Open Build → Package Project…, pick the WeChat platform in the Package Project dialog, review the Scenes in build list, and click Package. Estella cooks assets, bundles the SDK + your scripts (as CommonJS, via esbuild), transforms scenes, and writes a standalone MiniGame package.
-
Open the output folder in WeChat DevTools to compile, test, and submit. If you left the AppID empty, fill it in
project.config.jsonfrom DevTools.
The output directory contains game.js (the entry, which boots
game-bundle.js — the SDK + your scripts), game.json /
project.config.json (WeChat config), the asset-manifest.json, your scenes
as scenes/<name>.json, and a wasm/ folder holding the engine plus exactly
the side modules your scenes need. Every scene in the build is a
SceneManager.switchTo target — non-startup scenes load on their first switch
(see Scenes).

The WeChat target: the size limits under the title, then the target’s own settings, then the shared build options.
Compressed textures
Section titled “Compressed textures”With the Package dialog’s Compression set to By import settings, textures cook to KTX2 per their Compression import setting (Auto, GPU compressed or Original image) — a smaller package and faster first load. Two WeChat-specific details, both handled automatically:
- The Basis transcoder ships as the
basis-wechatside module — build it once (above), or the export fails with the exact command to run. - WeChat’s code package only accepts whitelisted file suffixes, and
ktx2isn’t one — so the exporter stages every.ktx2as.ktx2.bin, and the runtime resolves both spellings. The exporter also emitspackOptions.includerules inproject.config.jsonfor every staged custom extension (.skel,.atlas,.bin, …) so DevTools packs and serves them.
The engine binary
Section titled “The engine binary”The engine’s .wasm is the largest single file a mini-game ships. Two options
on the WeChat page of Package Project keep it out of the 4 MB main package:
- Compress wasm binaries ships the engine and every side module as
.wasm.br, roughly a third of the size; WeChat decompresses them on load. This needs base library 2.14.0 or later. The package carries only the compressed file and nothing checks the version at run time, so set the minimum base library of your mini-game in the WeChat console to 2.14.0 when you turn this on. - Engine in a subpackage moves the binary into a 分包 that loads at startup. It no longer counts against the main package; startup waits for that download, with the loading bar showing its progress.
EmscriptenGLX
Section titled “EmscriptenGLX”WeChat’s EmscriptenGLX runs the engine’s GL calls inside the wasm and hands them to the host in batches, instead of crossing into JavaScript for each one. In a scene of about a thousand draw calls it cut render time by about 12% on an Android phone.
Turn on Render through EmscriptenGLX on the WeChat page of Package Project, and build the engine it needs once:
node build-tools/cli.js build -t wechat-glxThe build downloads WeChat’s library at a pinned version and checks its hash,
and uses emsdk 4.0.10 (installed into tools/emsdk-glx the first time) — the
version that library is published for. It adds about 310 KB of wasm.
It takes effect on Android with base library 3.8.12 or later, and on iOS in
高性能+ mode. Any other host, including DevTools, renders through WebGL2 as
before; the log’s rendering through … line says which one a device used.
Subpackages (分包)
Section titled “Subpackages (分包)”Lazy asset groups become WeChat subPackages in game.json. At runtime,
assets.loadGroup('level2') triggers wx.loadSubpackage under the hood, so
levels download on demand rather than bloating the initial package:
{ "deviceOrientation": "landscape", "subPackages": [ { "name": "level2", "root": "subpackages/level2" } ]}Best practices
Section titled “Best practices”- Stay under the 4 MB main-package limit by moving on-demand content into
subpackages/<name>/— see Assets. The export setsbigPackageSizeSupport, so an oversized package still previews in DevTools — but upload enforces the cap. - Compress textures — see above (leave Compression on By import settings); the single biggest package-size win.
- Test in WeChat DevTools, not just the browser — the file system, storage, and socket backends differ from the web.
- Preload the next level’s group (
loadGroup) during play so the subpackage download doesn’t stall the transition.
See also
Section titled “See also”The WeChat Mini Game starter in the launcher includes a CC0 fleet game,
login-code/server-exchange hook, share request, configured rewarded video and
device-local saved credits. Follow its copied README.md to create, customize,
export and submit. Its named wechat profile enables compressed engine
subpackaging; its web profile offers local gameplay with unavailable host
buttons disabled. Set your own ad unit and server integration in src/config.ts.
No AppSecret or sample account is shipped. Login codes are not authenticated
identity, share requests do not prove completion, and saved credits are not cloud
backup. Validate your real account, backend, ads and devices separately.
- Assets — addressable groups and cooking map onto subpackages.
- Building & Exporting — the Package Project dialog.
- Video — the MPEG-1 wasm decode path shipped for WeChat.
- Networking — sockets use
wx.connectSockethere.