Egret’s compilation function depends on TypeScript’s compilation function. In fact, the compilation process of TypeScript is not the traditional process of translating program source code into a machine-executable secondary copy file. Since the only script that the browser can recognize and execute is JavaScript, the compilation of TypeScript only translates TypeScript into the corresponding JavaScript script.
We don’t need to understand the complicated process inside. We can only understand the compilation process as translating TypeScript into JavaScript code that can be executed by the browser.
This "translation" process is also very simple. We just need to execute a simple command. The command is as follows:
egret build HelloWorld
Where egret build is to perform the "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 compilation script, the compiler will 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 message.
Regarding the error prompt, we will explain it in detail in the debugging and running chapter.