diff --git a/index.js b/index.js index 657a261..e786939 100644 --- a/index.js +++ b/index.js @@ -11,9 +11,9 @@ var defaultVars = { return 'require(' + JSON.stringify(processPath) + ')'; }, global: function () { - return 'typeof global !== "undefined" ? global : ' - + 'typeof self !== "undefined" ? self : ' - + 'typeof window !== "undefined" ? window : {}' + return 'typeof window !== "undefined" && window.document && window.document.implementation ? window : ' + + 'typeof global !== "undefined" ? global : ' + + 'typeof self !== "undefined" ? self : {}' ; }, Buffer: function () {