Egret's compilation function depends on TypeScript's compilation function. In fact, TypeScript's compilation process is not a traditional process of translating program source code into a machine-executable secondary file. Since the browser can recognize that the script executed is only JavaScript, TypeScript compilation is just to translate TypeScript into the corresponding JavaScript script.
We don't need to understand the complex process, we can only understand the compilation process as translating TypeScript into JavaScript code that can be executed by the browser.
The process of "translation" is also very simple. We just need to execute a simple command. The command is as follows:
egret build HelloWorld
where egret build performs "translation" work, and HelloWorld is our project name.
The execution time of the command depends on the size of your project. Usually, when you run a compiler script, the compiler can quickly help you compile your game logic.
When the compilation command is executed, the terminal will automatically jump to the next line. If the command execution fails, the compiler will give you a very detailed error prompt.
Regarding the error prompt, we will explain in detail to you in the debugging and operation chapter.