Module Specifications and Examples
Modules are a way of organizing TypeScript/JavaScript code, and code organized in modules is also informally known as scripts or project scripts. In Cocos Creator, all code except plugin scripts is organized in modules, which are roughly divided into the following kinds, depending on their source:
Cocos Creator natively supports and recommends the use of the ECMAScript (ESM for short) module format. To support the use of external modules, Cocos Creator also supports the CommonJS module format to some extent. For additional information about the module format and usage in Cocos Creator, please refer to the Module Specification documentation.
The modules are loaded in the following order:
First import of the engine module of Cocos Creator 3.x.
Common scripts: all common scripts will be imported concurrently, and the import will strictly follow the reference relationships and execution order determined by .