scripts/build.js
function build() {
  console.log('Creating an optimized production build...\n');

  webpack(config)
    .run((err, stats) => {
      if (err) {
        printErrors('Failed to compile.', [err]);
        process.exit(1);
      }

      if (stats.compilation.errors.length) {
        printErrors('Failed to compile.', stats.compilation.errors);
        process.exit(1);
      }

      if (process.env.CI && stats.compilation.warnings.length) {
        printErrors('Failed to compile.', stats.compilation.warnings);
        process.exit(1);
      }

      logSuccess('Compiled successfully.\n');

      console.log('Bundle size details:\n');
      printFileSizes(stats);

      console.log(`\nThe ${chalk.green('build')} folder is ready to be deployed.\n`);
    });
}
function build() {
  console.log('Creating an optimized production build...\n');

  webpack(config)
    .run((err, stats) => {
      if (err) {
        printErrors('Failed to compile.', [err]);
        process.exit(1);
      }

      if (stats.compilation.errors.length) {
        printErrors('Failed to compile.', stats.compilation.errors);
        process.exit(1);
      }

      if (process.env.CI && stats.compilation.warnings.length) {
        printErrors('Failed to compile.', stats.compilation.warnings);
        process.exit(1);
      }

      logSuccess('Compiled successfully.\n');

      console.log('Bundle size details:\n');
      printFileSizes(stats);

      console.log(`\nThe ${chalk.green('build')} folder is ready to be deployed.\n`);
    });
}
function build ( ) { console . log ( 'Creating an optimized production build...\n' ) ; webpack ( config ) . run ( ( err , stats ) => { if ( err ) { printErrors ( 'Failed to compile.' , [ err ] ) ; process . exit ( 1 ) ; } if ( stats . compilation . errors . length ) { printErrors ( 'Failed to compile.' , stats . compilation . errors ) ; process . exit ( 1 ) ; } if ( process . env . CI && stats . compilation . warnings . length ) { printErrors ( 'Failed to compile.' , stats . compilation . warnings ) ; process . exit ( 1 ) ; } logSuccess ( 'Compiled successfully.\n' ) ; console . log ( 'Bundle size details:\n' ) ; printFileSizes ( stats ) ; console . log ( ` \n ${ chalk . green ( 'build' ) } \n ` ) ; } ) ; }
Create a production build
Create a production build