github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/build-blockchain-insurance-app-master/web/tools/build.js (about)

     1  import webpack from 'webpack';
     2  import webpackConfig from '../webpack.config.prod';
     3  import colors from 'colors';
     4  
     5  console.log('Compiling minified bundles...');
     6  
     7  webpack(webpackConfig).run((err, stats) => {
     8    if (err) {
     9      console.log(colors.red.bold(err));
    10      return 1;
    11    }
    12  
    13    const jsonStats = stats.toJson();
    14  
    15    if (jsonStats.hasErrors) {
    16      return jsonStats.errors.map(error => console.log(colors.red.bold(error.red)));
    17    }
    18  
    19    if (jsonStats.hasWarning) {
    20      console.log(colors.yellow.bold('Webpack generated the following warnings: '));
    21      jsonStats.warnings.map(warning => console.log(colors.yellow(warning)));
    22    }
    23  
    24    console.log(`Webpack stats: ${stats}`);
    25  
    26    console.log('App has been compiled in production mode and output to /dist');
    27  
    28    return 0;
    29  });