diff --git a/packages/react-dev-utils/FileSizeReporter.js b/packages/react-dev-utils/FileSizeReporter.js index e33eedda6dde2de11025c9a256f1539aaabebe45..221005fd8792a50dbf4417feec0f7d7c48b3d062 100644 --- a/packages/react-dev-utils/FileSizeReporter.js +++ b/packages/react-dev-utils/FileSizeReporter.js @@ -28,7 +28,7 @@ function printFileSizesAfterBuild( var assets = (webpackStats.stats || [webpackStats]) .map(stats => stats - .toJson() + .toJson({ all: false, assets: true }) .assets.filter(asset => /\.(js|css)$/.test(asset.name)) .map(asset => { var fileContents = fs.readFileSync(path.join(root, asset.name)); diff --git a/packages/react-dev-utils/WebpackDevServerUtils.js b/packages/react-dev-utils/WebpackDevServerUtils.js index bc0378459c5a890ae71dee6fc1d1178070e138b8..f83c722a0ffbde098506c4650bb1b029ea5b015e 100644 --- a/packages/react-dev-utils/WebpackDevServerUtils.js +++ b/packages/react-dev-utils/WebpackDevServerUtils.js @@ -150,7 +150,11 @@ function createCompiler(webpack, config, appName, urls, useYarn) { // We have switched off the default Webpack output in WebpackDevServer // options so we are going to "massage" the warnings and errors and present // them in a readable focused way. - const messages = formatWebpackMessages(stats.toJson({}, true)); + // We only construct the warnings and errors for speed: + // https://github.com/facebook/create-react-app/issues/4492#issuecomment-421959548 + const messages = formatWebpackMessages( + stats.toJson({ all: false, warnings: true, errors: true }) + ); const isSuccessful = !messages.errors.length && !messages.warnings.length; if (isSuccessful) { console.log(chalk.green('Compiled successfully!')); diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index bc0f81b1d7264ac326a68db4f1b525c8ac4680b3..6f2cdb40dd1eef2454e159d4c6ae69422d3c47ec 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -142,7 +142,9 @@ function build(previousFileSizes) { if (err) { return reject(err); } - const messages = formatWebpackMessages(stats.toJson({}, true)); + const messages = formatWebpackMessages( + stats.toJson({ all: false, warnings: true, errors: true }) + ); if (messages.errors.length) { // Only keep the first error. Others are often indicative // of the same problem, but confuse the reader with noise.