code: function(stream, data, cb) {
    // Reference default write method
    const oldWrite = stream.write;
  
    // Clear hook function
    const clearHook = function() {
      stream.write = oldWrite;
    };
  
    // New stream write with our shiny function
    stream.write = function() {
      // Old behaviour
      oldWrite.apply(stream, arguments);
      // Hook
      if (arguments[0] === data) {
        clearHook();
        cb();
      }
    };
  }
docs: http://stackoverflow.com/questions/30225866/gulp-webpack-dev-server-callback-before-bundle-is-finished