WeChat Mini Game
WeChat Mini Game has special Worker restrictions. ESEngine provides CLI tools to solve this.
Platform Differences
Section titled “Platform Differences”| Feature | Browser | |
|---|---|---|
| Dynamic scripts | ✅ | ❌ |
| Worker count | Multiple | Max 1 |
| Script source | Any | Package files only |
Using Worker Generator CLI
Section titled “Using Worker Generator CLI”# Installpnpm add -D @esengine/worker-generator
# Generate Worker filesnpx esengine-worker-gen --src ./src --wechatConfiguration
Section titled “Configuration”class PhysicsSystem extends WorkerEntitySystem<PhysicsData> { constructor() { super(matcher, { enableWorker: true, workerScriptPath: 'workers/physics-worker.js' }); }}Important Notes
Section titled “Important Notes”- Re-run CLI after modifying
workerProcess - Worker functions must be pure (no
this) - Pass config via
systemConfig