From 9bcbb1ae007967accaabcae6e01134e4f9e46cb8 Mon Sep 17 00:00:00 2001 From: Sven Gaubert Date: Mon, 25 Nov 2019 12:32:06 +0700 Subject: [PATCH] allow overriding webpack stats config --- bin/cmd.js | 5 ++--- lib/build.js | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index 74376fe2..92f0d7eb 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -63,8 +63,7 @@ program console.error(err); return; } - - console.log(stats.toString({ color: true })); + console.log(stats.toString(stats.compilation.options.stats)); if (!server) { startServer(); } @@ -84,7 +83,7 @@ program build .run(cmd, { userWebpackConfig, useBabelrc }) .then(function(stats) { - console.log(stats.toString({ color: true })); + console.log(stats.toString(stats.compilation.options.stats)); }) .catch(function(err) { console.error(err); diff --git a/lib/build.js b/lib/build.js index 6897392b..bf698910 100644 --- a/lib/build.js +++ b/lib/build.js @@ -115,7 +115,10 @@ function webpackConfig(dir, { userWebpackConfig, useBabelrc } = {}) { nodeEnv }, bail: true, - devtool: false + devtool: false, + stats: { + colors: true + } }; fs.readdirSync(dirPath).forEach(function(file) { if (file.match(/\.(m?js|ts)$/)) {