From: Ondřej Španěl Date: Fri, 24 Feb 2017 00:51:24 +0000 (+0100) Subject: Avoid using exports when undefined (#1471) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=852f78491a212ba20841847436dab93abb0a8181;p=UglifyJS.git Avoid using exports when undefined (#1471) Makes direct usage within web browser easier, even if officially unsupported. --- diff --git a/lib/ast.js b/lib/ast.js index 42506cb2..61643aed 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -81,7 +81,9 @@ function DEFNODE(type, props, methods, base) { ctor.DEFMETHOD = function(name, method) { this.prototype[name] = method; }; - exports["AST_" + type] = ctor; + if (typeof exports !== "undefined") { + exports["AST_" + type] = ctor; + } return ctor; };