From 9c57ae0d3d6831c02a57b08d593023109aa27f7b Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Wed, 28 Jun 2017 13:18:40 +0200 Subject: [PATCH] factor into one if --- app/react/src/server/build.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/react/src/server/build.js b/app/react/src/server/build.js index f618fabba8f8..f003fcb1cf4b 100755 --- a/app/react/src/server/build.js +++ b/app/react/src/server/build.js @@ -77,17 +77,10 @@ if (program.staticDir) { // compile all resources with webpack and write them to the disk. logger.log('Building storybook ...'); webpack(config).run((err, stats) => { - if (err) { - logger.error('Failed to build the storybook'); - logger.error(err.message); - } - if (stats.hasErrors()) { - logger.error('Failed to build the storybook'); - stats.toJson().errors.forEach(function (e) { - return logger.error(e); - }); - } if (err || stats.hasErrors()) { + logger.error('Failed to build the storybook'); + err && logger.error(err.message); + stats.hasErrors() && stats.toJson().errors.forEach(e => logger.error(e)); process.exit(1); }