mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Support node-like module loaders. Closes gh-1103
This commit is contained in:
parent
0f977e6d03
commit
a128355b25
@ -1,4 +1,11 @@
|
||||
// Expose jQuery to the global object
|
||||
if ( typeof module === "object" && typeof module.exports === "object" ) {
|
||||
// Expose jQuery as module.exports in loaders that implement the Node
|
||||
// module pattern (including browserify). Do not create the global, since
|
||||
// the user will be storing it themselves locally, and globals are frowned
|
||||
// upon in the Node module world.
|
||||
module.exports = jQuery;
|
||||
} else {
|
||||
// Otherwise expose jQuery to the global object as usual
|
||||
window.jQuery = window.$ = jQuery;
|
||||
|
||||
// Expose jQuery as an AMD module, but only for AMD loaders that
|
||||
@ -16,3 +23,4 @@ window.jQuery = window.$ = jQuery;
|
||||
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
||||
define( "jquery", [], function () { return jQuery; } );
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
|
||||
})( window );
|
||||
})( this );
|
||||
|
Loading…
Reference in New Issue
Block a user