How to use the react-dev-utils-for-webpack4/FileSizeReporter.measureFileSizesBeforeBuild function in react-dev-utils-for-webpack4

To help you get started, we’ve selected a few react-dev-utils-for-webpack4 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github entando / app-builder / scripts / build.js View on Github external

const path = require('path');
const chalk = require('chalk');
const fs = require('fs-extra');
const webpack = require('webpack');
const config = require('../config/');
const paths = require('../config/paths');
const checkRequiredFiles = require('react-dev-utils-for-webpack4/checkRequiredFiles');
const formatWebpackMessages = require('react-dev-utils-for-webpack4/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils-for-webpack4/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils-for-webpack4/FileSizeReporter');
const printBuildError = require('react-dev-utils-for-webpack4/printBuildError');

const measureFileSizesBeforeBuild =
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
const useYarn = fs.existsSync(paths.yarnLockFile);

// These sizes are pretty large. We'll warn for bundles exceeding them.
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;

// Warn and crash if required files are missing
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {

// First, read the current file sizes in build directory.
// This lets us display how much they changed later.
  .then(previousFileSizes => {