From 48e2c19de0423dbd10b9e1791854d6214f0023fd Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Fri, 17 Apr 2020 13:38:09 -0400 Subject: [PATCH] Serialize JSON Warnings Before Event (#11976) --- packages/next/build/output/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/next/build/output/index.ts b/packages/next/build/output/index.ts index c01bc2ac236ea..591f32bf96a2e 100644 --- a/packages/next/build/output/index.ts +++ b/packages/next/build/output/index.ts @@ -336,13 +336,15 @@ export function watchCompilers( stats.compilation.errors.push(...(filteredErrors || [])) stats.compilation.warnings.push(...(filteredWarnings || [])) + const { + errors: newErrors, + warnings: newWarnings, + } = formatWebpackMessages( + stats.toJson({ all: false, warnings: true, errors: true }) + ) onTypeChecked({ - errors: stats.compilation.errors.length - ? stats.compilation.errors - : null, - warnings: stats.compilation.warnings.length - ? stats.compilation.warnings - : null, + errors: newErrors?.length ? newErrors : null, + warnings: newWarnings?.length ? newWarnings : null, }) onEvent({