diff --git a/lib/core.js b/lib/core.js index 9b28df75d..cbc19bae2 100644 --- a/lib/core.js +++ b/lib/core.js @@ -64,6 +64,11 @@ function setupGlobal() { Sugar = globalContext[SUGAR_GLOBAL]; // istanbul ignore if if (Sugar) { + if (typeof module !== 'undefined' && module.exports) { + // Node or webpack environment + module.exports = Sugar; + } + // Reuse already defined Sugar global object. return; }