I am searching for an AMD loader that supports dynamic code loading, and that is very small.
The loader is to be used in a mobile/high latency environment, and the size of requirejs simply is too much.
I do NOT need:
-text plugins
-css plugins
-i18n plugins
What is the smallest AMD loader that supports these features? I'm looking for something that ideally is no larger than 5k when minified. Gzip is not to be included in this measure.
Asynchronous module definition (AMD) is a specification for the programming language JavaScript. It defines an application programming interface (API) that defines code modules and their dependencies, and loads them asynchronously if desired.
AMD and CommonJS are both Javascript module loader. They accomplish the same task but works different. AMD is better for browser, hence, the name 'Asynchronous', as it loads each distinct module in async manner instead of loading in one large file. No extra steps are required to use AMD, it works out-of-the-box.
Advertisements. A module in RequireJS is a scoped object and is not available in the global namespace. Hence, global namespace will not be polluted. RequireJS syntax allows to load modules faster without worrying about keeping track of the order of dependencies.
By "dynamic code loading," do you mean something like this?
You may want to try (listed in order of size):
Full disclosure: I wrote amdlite. It passes all relevant unit tests, but has not seen much real-world use. If you try it and discover anything wrong with it, please file an issue.
I believe this is reasonably close to the AMD spec, and at 960 bytes minified (not counting the spurious newline at the end) might grab the top spot.
https://github.com/MaxMotovilov/eeMD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With