From 65ca9b2a1c5a756ca8587b364636ff732db19c22 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Mon, 16 Jan 2023 15:51:06 -0800 Subject: [PATCH] Remove `react-dev-utils` error compatibility workaround To work around a `react-dev-utils` compatibility problem, errors and warnings had context stripped before being formatted. Since this workaround was was only needed until `react-dev-utils` v5 was release (now over a year ago, nice! [1]), I think that it can be removed. [1] https://github.com/facebook/create-react-app/releases/tag/v5.0.0 Signed-off-by: Mitchell Hentges --- packages/cli/src/lib/bundler/bundle.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/cli/src/lib/bundler/bundle.ts b/packages/cli/src/lib/bundler/bundle.ts index a8967bb250..32e4c1a181 100644 --- a/packages/cli/src/lib/bundler/bundle.ts +++ b/packages/cli/src/lib/bundler/bundle.ts @@ -122,15 +122,9 @@ async function build(config: webpack.Configuration, isCi: boolean) { warnings: true, errors: true, }); - // NOTE(freben): The code below that extracts the message part of the errors, - // is due to react-dev-utils not yet being compatible with webpack 5. This - // may be possible to remove (just passing the serialized stats object - // directly into the format function) after a new release of react-dev-utils - // has been made available. - // See https://github.com/facebook/create-react-app/issues/9880 const { errors, warnings } = formatWebpackMessages({ - errors: serializedStats.errors?.map(e => (e.message ? e.message : e)), - warnings: serializedStats.warnings?.map(e => (e.message ? e.message : e)), + errors: serializedStats.errors, + warnings: serializedStats.warnings, }); if (errors.length) {