apply(compiler) {
    compiler.hooks.invalid.tap('invalid', () => {
      this.stdout('compiling...');
    });

    compiler.hooks.done.tap('done', stats => {
      // don't care about module messages
      // just warnings + errors
      const statsData = stats.toJson({
        all: false,
        warnings: true,
        errors: true
      });

      const wasSuccessful =
        !statsData.errors.length && !statsData.warnings.length;
      if (wasSuccessful) {
        this.stdout('success!');
      }

      if (statsData.errors.length) {
        const error = statsData.errors[0];
        return this.stdout(formatErrorMessage(error));
      }

      if (statsData.warnings.length) {
        this.stdout(statsData.warnings.join('\n\n'));
      }
    });
  }
// Define `apply` as its prototype method which is supplied with compiler as its argument
Define `apply` as its prototype method which is supplied with compiler as its argument
Define ` apply ` as its prototype method which is supplied with compiler as its argument
apply(compiler) {
    compiler.hooks.invalid.tap('invalid', () => {
      this.stdout('compiling...');
    });
    compiler.hooks.done.tap('done', stats => {
      const statsData = stats.toJson({
        all: false,
        warnings: true,
        errors: true
      });
      const wasSuccessful =
        !statsData.errors.length && !statsData.warnings.length;
      if (wasSuccessful) {
        this.stdout('success!');
      }
      if (statsData.errors.length) {
        const error = statsData.errors[0];
        return this.stdout(formatErrorMessage(error));
      }
      if (statsData.warnings.length) {
        this.stdout(statsData.warnings.join('\n\n'));
      }
    });
  }
apply ( compiler ) { compiler . hooks . invalid . tap ( 'invalid' , ( ) => { this . stdout ( 'compiling...' ) ; } ) ; compiler . hooks . done . tap ( 'done' , stats => { const statsData = stats . toJson ( { all : false , warnings : true , errors : true } ) ; const wasSuccessful = ! statsData . errors . length && ! statsData . warnings . length ; if ( wasSuccessful ) { this . stdout ( 'success!' ) ; } if ( statsData . errors . length ) { const error = statsData . errors [ 0 ] ; return this . stdout ( formatErrorMessage ( error ) ) ; } if ( statsData . warnings . length ) { this . stdout ( statsData . warnings . join ( '\n\n' ) ) ; } } ) ; }
Define `apply` as its prototype method which is supplied with compiler as its argument
Define ` apply ` as its prototype method which is supplied with compiler as its argument
// don't care about module messages // just warnings + errors