From 568161d418e506e78a817014216caef9ec230fa9 Mon Sep 17 00:00:00 2001 From: Sean Larkin Date: Sun, 17 Feb 2019 18:15:10 -0800 Subject: [PATCH] fix(bin): use compiler.close API correctly for stats This fixes #762 ISSUES CLOSED: #762 --- bin/cli.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index ea12dfc0c1e..b0dc2649d2d 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -251,7 +251,7 @@ For more information, see https://webpack.js.org/api/cli/.`); const stdout = argv.silent ? { write: () => {} - } // eslint-disable-line + } // eslint-disable-line : process.stdout; function ifArg(name, fn, init) { @@ -488,13 +488,18 @@ For more information, see https://webpack.js.org/api/cli/.`); } compiler.watch(watchOptions, compilerCallback); if (outputOptions.infoVerbosity !== "none") console.error("\nwebpack is watching the files…\n"); - if (compiler.close) compiler.close(compilerCallback); } else { - compiler.run(compilerCallback); - if (compiler.close) compiler.close(compilerCallback); + compiler.run((err, stats) => { + if (compiler.close) { + compiler.close(err2 => { + compilerCallback(err || err2, stats); + }); + } else { + compilerCallback(err, stats); + } + }); } } - processOptions(options); }); })();