Skip to content

Commit 19b7e2c

Browse files
developitForsakenHarmony
authored andcommitted
Bugfix: check existence of stats before using it (#845)
1 parent cac499c commit 19b7e2c

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

packages/cli/lib/lib/webpack/run-webpack.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,18 @@ function runCompiler(compiler) {
113113
}
114114

115115
function showStats(stats) {
116-
if (stats.hasErrors()) {
117-
allFields(stats, 'errors')
118-
.map(stripLoaderPrefix)
119-
.forEach(msg => error(msg));
120-
}
116+
if (stats) {
117+
if (stats.hasErrors()) {
118+
allFields(stats, 'errors')
119+
.map(stripLoaderPrefix)
120+
.forEach(msg => error(msg));
121+
}
121122

122-
if (stats.hasWarnings()) {
123-
allFields(stats, 'warnings')
124-
.map(stripLoaderPrefix)
125-
.forEach(msg => warn(msg));
123+
if (stats.hasWarnings()) {
124+
allFields(stats, 'warnings')
125+
.map(stripLoaderPrefix)
126+
.forEach(msg => warn(msg));
127+
}
126128
}
127129

128130
return stats;

0 commit comments

Comments
 (0)