I am exploring if there is a way to determine if a given script is currently loading RequireJS. The answer for AMD modules in general will be even better, but my use case is only RequireJS.
jQuery and other libraries "discover" this:
if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; }); }
In most cases, this is enough, but the problem is that it does not detect if the script is loading as an AMD module, it only determines if define exists and supports the AMD specification.
Is there a way, both with RequireJS and with AMD modules in general, for a script to determine (for real) whether it loads as a module?
javascript requirejs amd
mwcz
source share