diff --git a/lib/6to5/transformation/modules/umd.js b/lib/6to5/transformation/modules/umd.js index 1a502a24a1..299a4aee22 100644 --- a/lib/6to5/transformation/modules/umd.js +++ b/lib/6to5/transformation/modules/umd.js @@ -39,8 +39,8 @@ UMDFormatter.prototype.transform = function (ast) { defineArgs = [t.arrayExpression(defineArgs)]; // typeof exports !== "undefined" && typeof module !== "undefined" - var testExports = t.binaryExpression("!==", t.typeOfExpression(t.identifier("exports")), t.literal("undefined")), - testModule = t.binaryExpression("!==", t.typeOfExpression(t.identifier("module")), t.literal("undefined")), + var testExports = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("exports"), true), t.literal("undefined")), + testModule = t.binaryExpression("!==", t.unaryExpression("typeof", t.identifier("module"), true), t.literal("undefined")), commonTests = this.passModuleArg ? t.logicalExpression("&&", testExports, testModule) : testExports; var commonArgs = [t.identifier("exports")];