1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Log original error

This commit is contained in:
Tim Neutkens 2018-11-04 23:04:54 +01:00
parent a97c15d399
commit d5caafb86e

View file

@ -52,18 +52,22 @@ function runCompiler (compiler) {
return reject(err) return reject(err)
} }
const jsonStats = stats.toJson({ warnings: true, errors: true }) let buildFailed = false
for (const stat of stats.stats) {
if (jsonStats.errors.length > 0) { for (const error of stat.compilation.errors) {
console.log() buildFailed = true
console.log(...jsonStats.warnings) console.error('ERROR', error)
console.error(...jsonStats.errors) console.error('ORIGINAL ERROR', error.error)
return reject(new Error('Soft webpack errors'))
} }
if (jsonStats.warnings.length > 0) { for (const warning of stat.compilation.warnings) {
console.log() buildFailed = true
console.log(...jsonStats.warnings) console.warn('WARNING', warning)
}
}
if (buildFailed) {
return reject(new Error('Webpack errors'))
} }
resolve() resolve()