WeChat MiniGame
Estella exports the same project to WeChat MiniGames. You build the engine for the WeChat target, 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 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 3.8 + 4.1 + 4.2)node 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 Project Settings → Packaging → WeChat, set your AppID. Screen orientation is project-wide — set it once in Project Settings → Display → Orientation (it drives the
game.jsondeviceOrientationbelow). -
Open File → Build…, 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).
Compressed textures
Section titled “Compressed textures”Enable Compress textures in the Package dialog to cook PNGs to KTX2 — 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.
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; 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”- 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.