lib/bundler.js
function compile(emit) {
    self.bundler.run(function(err, stats) {

      // Error handling
      if (err || stats.compilation.errors.length) {

        // Over time we expect webpack's resolution system to change. We choose to attempt
        // package installations by catching errors so as to maximize forward-compability.
        // Should the error reporting format change, we will need to update our resolution system.
        var errors = stats.toJson({ errorDetails: true }).errors;
        var recompile = errors.reduce(function(recompile, err) {
          if (Resolver.isMissingModuleError(err))
            recompile = Resolver.installPackageFromError(err);
          return recompile;
        }, false);
        if (recompile) return compile();

        if (err) global.shipp.logger.error(err);
        if (stats.compilation.errors.length) global.shipp.logger.error(stats.toString({ errorDetails: true }));

        return;

      }

      global.shipp.log("Bundled", self.path);
      if (emit) global.shipp.emit("route:refresh", { route: self.path });

    });
  }
function compile(emit) {
    self.bundler.run(function(err, stats) {

      // Error handling
      if (err || stats.compilation.errors.length) {

        // Over time we expect webpack's resolution system to change. We choose to attempt
        // package installations by catching errors so as to maximize forward-compability.
        // Should the error reporting format change, we will need to update our resolution system.
        var errors = stats.toJson({ errorDetails: true }).errors;
        var recompile = errors.reduce(function(recompile, err) {
          if (Resolver.isMissingModuleError(err))
            recompile = Resolver.installPackageFromError(err);
          return recompile;
        }, false);
        if (recompile) return compile();

        if (err) global.shipp.logger.error(err);
        if (stats.compilation.errors.length) global.shipp.logger.error(stats.toString({ errorDetails: true }));

        return;

      }

      global.shipp.log("Bundled", self.path);
      if (emit) global.shipp.emit("route:refresh", { route: self.path });

    });
  }
function compile ( emit ) { self . bundler . run ( function ( err , stats ) { // Error handling if ( err || stats . compilation . errors . length ) { // Over time we expect webpack's resolution system to change. We choose to attempt // package installations by catching errors so as to maximize forward-compability. // Should the error reporting format change, we will need to update our resolution system. var errors = stats . toJson ( { errorDetails : true } ) . errors ; var recompile = errors . reduce ( function ( recompile , err ) { if ( Resolver . isMissingModuleError ( err ) ) recompile = Resolver . installPackageFromError ( err ) ; return recompile ; } , false ) ; if ( recompile ) return compile ( ) ; if ( err ) global . shipp . logger . error ( err ) ; if ( stats . compilation . errors . length ) global . shipp . logger . error ( stats . toString ( { errorDetails : true } ) ) ; return ; } global . shipp . log ( "Bundled" , self . path ) ; if ( emit ) global . shipp . emit ( "route:refresh" , { route : self . path } ) ; } ) ; }
Wrap compilation in order to promisify and log bundling. We cannot use "promisify" since we require the "stats" object in our error callback.
Wrap compilation in order to promisify and log bundling . We cannot use promisify since we require the stats object in our error callback .