mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
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
This commit is contained in:
parent
18488f47b0
commit
1b8f56556b
|
@ -42,13 +42,18 @@ function runCompiler (compiler) {
|
||||||
webpackCompiler.run((err, stats) => {
|
webpackCompiler.run((err, stats) => {
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
|
|
||||||
const jsonStats = stats.toJson('errors-only')
|
const jsonStats = stats.toJson({ warnings: true, errors: true })
|
||||||
|
|
||||||
if (jsonStats.errors.length > 0) {
|
if (jsonStats.errors.length > 0) {
|
||||||
const error = new Error(jsonStats.errors[0])
|
console.log()
|
||||||
error.errors = jsonStats.errors
|
console.log(...jsonStats.warnings)
|
||||||
error.warnings = jsonStats.warnings
|
console.error(...jsonStats.errors)
|
||||||
return reject(error)
|
return reject(new Error('Soft webpack errors'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonStats.warnings.length > 0) {
|
||||||
|
console.log()
|
||||||
|
console.log(...jsonStats.warnings)
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve()
|
resolve()
|
||||||
|
|
Loading…
Reference in a new issue