The AMD (asynchronous module definition) Asynchronous module Definition specification defines the rules for defining modules so that the dependencies of modules and modules can be loaded asynchronously.
This specification defines only one function and is a global variable: define (id?,dependencies?,factory)
Here we mainly organize the naming rules of the ID.
ID A string that defines the name of the module, which is optional. If this parameter is not provided, the module name should default to the specified script name requested by the module loader. If the parameter is provided, it must be top-level or relative .
AMD's module naming specification is a superset of the COMMONJS module name specification. The references are as follows:
- The module name is a string made up of one or more forward slashes (/) as delimiters;
- The word must be in camel form or ".", "..." ;
- The module name does not allow the form of a file extension, such as. js;
- The module name can be relative or top-level. If the first letter is "." or ".." is relative;
- The top-level module names are parsed from the conceptual module of the root namespace;
- The relative module name is parsed from the require writing and calling module.
Example of relative module name resolution:
- If the module "A/B/C" Request ": /d ", then resolves to" A/d "
- If the module "A/B/C" Requests "./e", it resolves to "a/b/e"
These are the AMD module naming conventions.
Reference from Https://github.com/amdjs/amdjs-api/wiki/AMD
Naming rules for module IDs in the AMD specification