Skip to content

WeChat Mini Game

WeChat Mini Game has special Worker restrictions. ESEngine provides CLI tools to solve this.

FeatureBrowserWeChat
Dynamic scripts
Worker countMultipleMax 1
Script sourceAnyPackage files only
Terminal window
# Install
pnpm add -D @esengine/worker-generator
# Generate Worker files
npx esengine-worker-gen --src ./src --wechat
class PhysicsSystem extends WorkerEntitySystem<PhysicsData> {
constructor() {
super(matcher, {
enableWorker: true,
workerScriptPath: 'workers/physics-worker.js'
});
}
}
  1. Re-run CLI after modifying workerProcess
  2. Worker functions must be pure (no this)
  3. Pass config via systemConfig