gulpfile.js
function () {
    var start = Date.now();
    bundler.bundle()
      .on('error', gutil.log)
      .pipe(source(options.name))
      .pipe(gulpif(options.uglify, streamify(uglify())))
      .pipe(gulp.dest(options.dest))
      .pipe(notify(function () {

        // Fix for requirejs
        var fs = require('fs');
        var file = fs.readFileSync(options.dest + '/' + options.name).toString();
        file = file.replace('define([],e)', 'define(["react"],e)');
        fs.writeFileSync(options.dest + '/' + options.name, file);

        console.log('Built in ' + (Date.now() - start) + 'ms');

      }));

  }
function () {
    var start = Date.now();
    bundler.bundle()
      .on('error', gutil.log)
      .pipe(source(options.name))
      .pipe(gulpif(options.uglify, streamify(uglify())))
      .pipe(gulp.dest(options.dest))
      .pipe(notify(function () {

        // Fix for requirejs
        var fs = require('fs');
        var file = fs.readFileSync(options.dest + '/' + options.name).toString();
        file = file.replace('define([],e)', 'define(["react"],e)');
        fs.writeFileSync(options.dest + '/' + options.name, file);

        console.log('Built in ' + (Date.now() - start) + 'ms');

      }));

  }
function ( ) { var start = Date . now ( ) ; bundler . bundle ( ) . on ( 'error' , gutil . log ) . pipe ( source ( options . name ) ) . pipe ( gulpif ( options . uglify , streamify ( uglify ( ) ) ) ) . pipe ( gulp . dest ( options . dest ) ) . pipe ( notify ( function ( ) { // Fix for requirejs var fs = require ( 'fs' ) ; var file = fs . readFileSync ( options . dest + '/' + options . name ) . toString ( ) ; file = file . replace ( 'define([],e)' , 'define(["react"],e)' ) ; fs . writeFileSync ( options . dest + '/' + options . name , file ) ; console . log ( 'Built in ' + ( Date . now ( ) - start ) + 'ms' ) ; } ) ) ; }
The actual rebundle process
The actual rebundle process