Commit 1b8f5655 authored by Timmy Willison's avatar Timmy Willison Committed by Tim Neutkens

Output warnings and errors from webpack individually (#5442)

- Shows warnings even when resolving, to facilitate hints set to 'warning'
- Fixes #876 : Set performance.hints to 'warning' or 'error' in next.config.js
parent 18488f47
......@@ -42,13 +42,18 @@ function runCompiler (compiler) {
webpackCompiler.run((err, stats) => {
if (err) return reject(err)
const jsonStats = stats.toJson('errors-only')
const jsonStats = stats.toJson({ warnings: true, errors: true })
if (jsonStats.errors.length > 0) {
const error = new Error(jsonStats.errors[0])
error.errors = jsonStats.errors
error.warnings = jsonStats.warnings
return reject(error)
console.log()
console.log(...jsonStats.warnings)
console.error(...jsonStats.errors)
return reject(new Error('Soft webpack errors'))
}
if (jsonStats.warnings.length > 0) {
console.log()
console.log(...jsonStats.warnings)
}
resolve()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment