From 76361fcb9942d9ffdce15485de4bbd76df57b8d3 Mon Sep 17 00:00:00 2001 From: Jin Zheng Date: Thu, 25 May 2017 23:18:29 +0800 Subject: [PATCH] Print file sizes with correct build folder path. (#2361) * Print file sizes with correct build folder path. * Just use the print the basename. --- packages/react-dev-utils/FileSizeReporter.js | 4 ++-- packages/react-scripts/scripts/build.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-dev-utils/FileSizeReporter.js b/packages/react-dev-utils/FileSizeReporter.js index a0db0684f4a..8f822d20133 100644 --- a/packages/react-dev-utils/FileSizeReporter.js +++ b/packages/react-dev-utils/FileSizeReporter.js @@ -18,7 +18,7 @@ var stripAnsi = require('strip-ansi'); var gzipSize = require('gzip-size').sync; // Prints a detailed summary of build files. -function printFileSizesAfterBuild(webpackStats, previousSizeMap) { +function printFileSizesAfterBuild(webpackStats, previousSizeMap, buildFolder) { var root = previousSizeMap.root; var sizes = previousSizeMap.sizes; var assets = webpackStats @@ -30,7 +30,7 @@ function printFileSizesAfterBuild(webpackStats, previousSizeMap) { var previousSize = sizes[removeFileNameHash(root, asset.name)]; var difference = getDifferenceLabel(size, previousSize); return { - folder: path.join('build', path.dirname(asset.name)), + folder: path.join(path.basename(buildFolder), path.dirname(asset.name)), name: path.basename(asset.name), size: size, sizeLabel: filesize(size) + (difference ? ' (' + difference + ')' : ''), diff --git a/packages/react-scripts/scripts/build.js b/packages/react-scripts/scripts/build.js index 6548609ff3c..bc46c71d6da 100644 --- a/packages/react-scripts/scripts/build.js +++ b/packages/react-scripts/scripts/build.js @@ -75,7 +75,7 @@ measureFileSizesBeforeBuild(paths.appBuild) } console.log('File sizes after gzip:\n'); - printFileSizesAfterBuild(stats, previousFileSizes); + printFileSizesAfterBuild(stats, previousFileSizes, paths.appBuild); console.log(); const appPackage = require(paths.appPackageJson);