With AMD modules, when (or why) is it OK to use require() within define()?
问题 My understanding of AMD modules (using for example RequireJs or curl.js) is: require() is used to asynchronously load different modules and when loaded then the callback fn is executed. And to define a module, you would have separate scripts that use define() But I've seen some modules use require() inside their function definition, e.g. define([a, b, c], function(i, ii, iii){ require([d, e, f], function(d, e, f) { // do some stuff with these require()'d dependancies }) /* rest of the code