From: AMD wiki
I think Yii2 could ship an AMD-loader like RequireJS or curl. This loader could be used internally by the ClientScript class or maybe also by the asset manager (didn’t elaborate on this, but at least RequireJS supports optimization of scripts, so maybe this could be done when publishing assets in production mode).
jQuery can be loaded as AMD module since v1.7. jQuery UI doesn’t support it yet, but it seems like it is not too difficult to turn the widgets into AMD modules (see here).
I stumbled over this when I was playing with backbone to implement a facebook app. Very soon, I encountered some problems like backbone depending on jQuery and underscore (both need to be loaded before backbone), race conditions between jQuery’s ready event and facebook sdk’s asyncInit, …
Finally I decided to give curl a try, and it seems to do a good job. I still miss lazy-loading dependencies, but I’m not sure if this is covered by AMD. Also, loading non-AMD scripts like underscore and backbone was no problem, so it seems like using the loader does not mean you limit yourself to AMD modules only.
What do you think about it?
// EDIT: add link to AMD wiki