From 61b0f0c4c39508cf59566a0c9c73a931f1fdbae0 Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Wed, 6 Sep 2017 11:14:26 -0600 Subject: [PATCH] Catch uglify errors --- src/meta/minifier.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/meta/minifier.js b/src/meta/minifier.js index 4b64420701..a3e40d195a 100644 --- a/src/meta/minifier.js +++ b/src/meta/minifier.js @@ -230,23 +230,23 @@ function minifyJS(data, callback) { scripts[ref.filename] = ref.source; }); - try { - var minified = uglifyjs.minify(scripts, { - sourceMap: { - filename: data.filename, - url: data.filename + '.map', - includeSources: true, - }, - compress: false, - }); + var minified = uglifyjs.minify(scripts, { + sourceMap: { + filename: data.filename, + url: data.filename + '.map', + includeSources: true, + }, + compress: false, + }); - async.parallel([ - async.apply(fs.writeFile, data.destPath, minified.code), - async.apply(fs.writeFile, data.destPath + '.map', minified.map), - ], callback); - } catch (e) { - callback(e); + if (minified.error) { + return callback(minified.error); } + + async.parallel([ + async.apply(fs.writeFile, data.destPath, minified.code), + async.apply(fs.writeFile, data.destPath + '.map', minified.map), + ], callback); }); } actions.minifyJS = minifyJS;