diff --git a/underscore.js b/underscore.js index f2c8c94b7..fd9ea3d08 100644 --- a/underscore.js +++ b/underscore.js @@ -56,6 +56,14 @@ exports = module.exports = _; } exports._ = _; + } else if (typeof define === 'function' && define.amd) { + // Register as a module with AMD. Use a named module since underscore + // can be used in optimization schemes that do not understand anonymous + // modules, and the if it is used on a page with an AMD loader, a load + // error could occur. + define('underscore', function() { + return _; + }); } else { // Exported as a string, for Closure Compiler "advanced" mode. root['_'] = _;