When exporting to the WeChat Mini Game platform, there are the following configuration items:
Configuration | Describe | Corresponding to the configuration file of WeChat Mini Games | Corresponding to the fields in WeChat Mini Games |
---|---|---|---|
AppId | AppId of WeChat Mini Game, required. The wxdf8199565c509fb9 in the screenshot is a test account. | project.config.json | appid |
Orientation | Set the game screen orientation: Landscape, Portrait | game.json | deviceOrientation |
Request | wx.request timeout, unit: milliseconds | game.json | networkTimeout.request |
Connect Socket | wx.connectSocket timeout, unit: milliseconds | game.json | networkTimeout.connectSocket |
Upload File | wx.uploadFile timeout, unit: milliseconds | game.json | networkTimeout.uploadFile |
Download File | wx.downloadFile timeout, unit: milliseconds | game.json | networkTimeout.downloadFile |
Subpackages | Subpackage list configuration | game.json | subpackages |
For more configuration details, see: project.config.json、game.json
After selecting the WeChat Mini Game platform, click the download button at the bottom of the export panel to export the required project:
Project Directory Description
Directory or File | Description |
---|---|
public | Asset directory. All assets from the editor are exported to this directory, and the asset path is /public/xxx |
scripts | Scripts added by developers in the editor. After exporting locally, developers can further develop these script components |
game.json | Corresponds to the game.json required for the WeChat Mini Game project |
game.ts | Entry file where all initialization logic is placed |
package.json | Mainly stores project dependencies |
project.config.json | Corresponds to the project.config.json required for the WeChat Mini Game project |
project.ts | Galacean project file, containing initialization-related information |
npm i
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:
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.
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.
engine.resourceManager.load
.After completing local debugging, you can proceed with the release. For detailed release steps, see: WeChat Mini Game Release