After creating a project, we need to release the project as the official version and provide it to players online. The simple use of the build command in egret is not to package the final official file. You also need to perform the final release operation. In Egret, the publishing function is also very simple. You only need to use the following command:
egret publish HelloWorld
In this command, egret publish is the release command, and HelloWorld is the name of your current project.
After you run this command, egret starts the release package. In this case, the release process may take longer than the build function. Because the Egret tool will make the final release of your game code, this work is a very strict compilation process. The process is very complicated. We only need to understand its role.
You also need to install Java 7 to use the release function of Egret. You should install Java 7 or later to support your release function.
After the release function is executed, Egret will encrypt and confuse your source code, and put all the js Code into the game-min.js file, and the content of the file is obfuscated and compressed. In this way, you can upload files in the project's release folder to your server and access the corresponding URL to open the game.
The final game access address is the index.html file under the release directory.
You can also create a version number for the packaged file by running the following command:
egret publish HelloWorld --v abc
Use the above command to generate a folder named abc under the release folder, which contains the released code.
The -- v parameter specifies the version number of the release, and the folder name after the release is generated.
Modular Compilation
In versions earlier than egret, all the code in the engine will be compiled into a file after publish, but developers may not use all the functions in the engine, resulting in additional network transmission overhead.
In version 1.0.4, We optimized this problem. Currently, the egret engine has five modules: core/gui/dragonbones/html5/native. Developers only need to go to egretProerties. by configuring your module in the json file, you can compile the specified module to reduce the compilation volume.