Skip to content

Commit

Permalink
fix: fallback to stats when compiler.options is undefined in webpack 4
Browse files Browse the repository at this point in the history
  • Loading branch information
piecyk committed Oct 23, 2020
1 parent 65107da commit 1e198f1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/webpack-cli/lib/webpack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ class WebpackCLI extends GroupHelper {
return stats;
};

const getStatsOptionsFromCompiler = (compiler) => getStatsOptions(compiler.options ? compiler.options.stats : undefined);

const foundStats = compiler.compilers
? { children: compiler.compilers.map((compiler) => getStatsOptions(compiler.options.stats)) }
: getStatsOptions(compiler.options.stats);
? { children: compiler.compilers.map(getStatsOptionsFromCompiler) }
: getStatsOptionsFromCompiler(compiler);

if (outputOptions.json === true) {
process.stdout.write(JSON.stringify(stats.toJson(foundStats), null, 2) + '\n');
Expand Down

0 comments on commit 1e198f1

Please sign in to comment.