Platform

Export To WechatMiniGame

Platform Configuration Instructions

When exporting to the WeChat Mini Game platform, there are the following configuration items:

ConfigurationDescribeCorresponding to the configuration file of WeChat Mini GamesCorresponding to the fields in WeChat Mini Games
AppIdAppId of WeChat Mini Game, required. The wxdf8199565c509fb9 in the screenshot is a test account.project.config.jsonappid
OrientationSet the game screen orientation: Landscape, Portraitgame.jsondeviceOrientation
Requestwx.request timeout, unit: millisecondsgame.jsonnetworkTimeout.request
Connect Socketwx.connectSocket timeout, unit: millisecondsgame.jsonnetworkTimeout.connectSocket
Upload Filewx.uploadFile timeout, unit: millisecondsgame.jsonnetworkTimeout.uploadFile
Download Filewx.downloadFile timeout, unit: millisecondsgame.jsonnetworkTimeout.downloadFile
SubpackagesSubpackage list configurationgame.jsonsubpackages

For more configuration details, see: project.config.jsongame.json

Export

After selecting the WeChat Mini Game platform, click the download button at the bottom of the export panel to export the required project:

Debug

  1. After exporting from the editor to the local directory, the directory structure is as follows:

Project Directory Description

Directory or FileDescription
publicAsset directory. All assets from the editor are exported to this directory, and the asset path is /public/xxx
scriptsScripts added by developers in the editor. After exporting locally, developers can further develop these script components
game.jsonCorresponds to the game.json required for the WeChat Mini Game project
game.tsEntry file where all initialization logic is placed
package.jsonMainly stores project dependencies
project.config.jsonCorresponds to the project.config.json required for the WeChat Mini Game project
project.tsGalacean project file, containing initialization-related information
  1. After exporting the project locally, navigate to the root directory and run the following command to install dependencies:
npm i
  1. To locally build the output required for the WeChat Mini Game platform during the debugging phase, run the following command:
npm run dev

After running this command, a new directory will be generated in the root directory of the project. This directory contains the output required for the WeChat Mini Game, as shown below:

When running the dev command, the output will include source map files for debugging. Once the developer has completed debugging and is ready to release, the following command can be executed:

npm run release

After running this command, the output compared to dev will remove the source map files and compress the code, making it smaller and suitable for release, as shown below:

  1. Open WeChat Developer Tools, select Mini Game, and import the directory generated in step 3, as shown below:
  1. After completing step 4, you can preview the final result in the WeChat Developer Tools, as shown below:
  1. For debugging in the WeChat Developer Tools, see: WeChat Mini Game Debugging

Subpackage

Overview

As mini-games become increasingly complex with more content, the package size grows, affecting loading speed. WeChat Mini Games provide a subpackage feature that splits the game content into a main package and subpackages according to rules. The main package contains resources necessary for the initial launch, while subpackages are loaded as needed, allowing users to quickly enter the game.

Subpackage Configuration in Galacean Editor

In the Galacean editor, folders are the unit for subpackage division. Content not in subpackages will go into the main package. When exporting the mini-game, add subpackages in the subpackage list of the export panel and associate them with folders to complete the subpackage configuration.

Subpackage Configuration Steps

  1. Open the export panel, select the WeChat Mini Game platform, and click the "Add Subpackage" button in the subpackage list to add a subpackage:
  1. In the subpackage, select the folder to be included in the subpackage to complete the configuration:

Notes

  • Script resources in folders set as subpackages will not be included in the subpackage but will be exported to the main package separately.
  • In WeChat Mini Games, the main package size is limited to 4MB. There is no size limit for a single subpackage, but the total size of the main package and subpackages cannot exceed 30MB. For more detailed rules, see: Subpackage
  • The configuration, loading, and other processes of subpackages are automatically handled by the engine. Developers can dynamically load assets in subpackages and regular assets in the same way using engine.resourceManager.load.

Release

After completing local debugging, you can proceed with the release. For detailed release steps, see: WeChat Mini Game Release

Was this page helpful?