From c86a2fe3a86c2b84467d7454d1330c33c5e13ad9 Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Wed, 1 Dec 2010 09:44:11 -0500 Subject: [PATCH] Safer CommonJS detection... module.exports must be defined. --- underscore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/underscore.js b/underscore.js index cfd9a0763..33925ded8 100644 --- a/underscore.js +++ b/underscore.js @@ -50,7 +50,7 @@ // Export the Underscore object for **CommonJS**, with backwards-compatibility // for the old `require()` API. If we're not in CommonJS, add `_` to the // global object. - if (typeof module !== 'undefined') { + if (typeof module !== 'undefined' && module.exports) { module.exports = _; _._ = _; } else {