diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/node.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/node.js b/tools/node.js index f6048661..7e61d2a1 100644 --- a/tools/node.js +++ b/tools/node.js @@ -45,6 +45,7 @@ exports.minify = function(files, options) { UglifyJS.base54.reset(); // 1. parse + var haveScope = false; var toplevel = null, sourcesContent = {}; @@ -73,6 +74,7 @@ exports.minify = function(files, options) { var compress = { warnings: options.warnings }; UglifyJS.merge(compress, options.compress); toplevel.figure_out_scope(); + haveScope = true; var sq = UglifyJS.Compressor(compress); toplevel = toplevel.transform(sq); } @@ -80,11 +82,17 @@ exports.minify = function(files, options) { // 3. mangle if (options.mangle) { toplevel.figure_out_scope(options.mangle); + haveScope = true; toplevel.compute_char_frequency(options.mangle); toplevel.mangle_names(options.mangle); } - // 4. output + // 4. scope (if needed) + if (!haveScope) { + toplevel.figure_out_scope(); + } + + // 5. output var inMap = options.inSourceMap; var output = {}; if (typeof options.inSourceMap == "string") { |