Skip to content

Commit

Permalink
Handle undefined webpack build error (#2360)
Browse files Browse the repository at this point in the history
In some cases, `stats.compilation.errors` contains an `undefined`. In these cases, `toJson` crashes when accessing a method on this undefined object. 
This change now filters out `undefined` errors
  • Loading branch information
iv-mexx authored and KyleAMathews committed Oct 16, 2017
1 parent 93a6b38 commit cfc0ae0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby/src/commands/build-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = async (program: any) => {
}
const outputFile = `${directory}/public/render-page.js`
if (stats.hasErrors()) {
let webpackErrors = stats.toJson().errors
let webpackErrors = stats.compilation.errors.filter((e) => e)
return reject(
createErrorFromString(webpackErrors[0], `${outputFile}.map`)
)
Expand Down

0 comments on commit cfc0ae0

Please sign in to comment.