From 3389687c42c18dcaa25aeb0ab44a6cb094b3c682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 25 Sep 2014 16:46:34 +0200 Subject: [PATCH] Do not check typeof module.exports === 'object', since it will be the Base constructor function after straps.js is included. Closes #461 --- src/export.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/export.js b/src/export.js index e7c590f4..fe8d5c22 100644 --- a/src/export.js +++ b/src/export.js @@ -26,15 +26,17 @@ paper = new (PaperScope.inject(Base.exports, { Key: Key }))(); +// https://github.com/umdjs/umd if (typeof define === 'function' && define.amd) { // Support AMD (e.g. require.js) // Use named module AMD syntax since there are other unnamed calls to // define() inside the built library (from inlined Acorn / Esprima) that // apparently confuse the require.js optimizer. define('paper', paper); -} else if (typeof module === 'object' && module // could be `null` - && typeof module.exports === 'object') { +} else if (typeof module === 'object' && module) { // could be `null` // Support CommonJS module + // NOTE: Do not check typeof module.exports === 'object' since it will be + // the Base constructor function after straps.js is included. module.exports = paper; }