'use strict';

var PORT = process.env.PORT || 3000;

var SOURCE_DIR = './app';
var BUILD_DIR = 'dist';

var _ = require('lodash');
var babelify = require('babelify');
var brfs = require('brfs');
var browserify = require('browserify');
var browserifyShim = require('browserify-shim');
var browserSync = require('browser-sync');
var del = require('del');
var mainBowerFiles = require('main-bower-files');
var runSequence = require('run-sequence');
var source = require('vinyl-source-stream');
var watchify = require('watchify');

var gulp = require('gulp');
var util = require('gulp-util');

function onError(error) {
  util.log(error.message);
  /*jshint validthis:true*/
  this.emit('end');
}

gulp.task('browser-sync', function() {
  return browserSync({
    browser: [],
    port: PORT,
    server: {
      baseDir: './' + BUILD_DIR
    }
  });
});

gulp.task('js', function() {
  var bundler = watchify(browserify(SOURCE_DIR + '/js/main.js',
    _.assign({
      debug: true
    }, watchify.args)));

  bundler
    .transform(babelify)
    .transform(brfs)
    .transform(browserifyShim);

  function rebundle() {
    return bundler.bundle()
      .on('error', onError)
      .pipe(source('bundle.js'))
      .pipe(gulp.dest(BUILD_DIR))
      .pipe(browserSync.reload({stream: true, once: true}));
  }

  bundler
    .on('log', util.log)
    .on('update', rebundle);

  return rebundle();
});

gulp.task('html', function() {
  return gulp.src(SOURCE_DIR + '/index.html')
    .pipe(gulp.dest(BUILD_DIR));
});

gulp.task('bower', function() {
  return gulp.src(mainBowerFiles())
    .pipe(gulp.dest(BUILD_DIR));
});

gulp.task('clean', del.bind(null, [BUILD_DIR]));

gulp.task('default', ['clean'], function(cb) {
  return runSequence(
    ['html', 'bower', 'js'],
    'browser-sync',
    cb
  );
});

@@ -8,19 +8,21 @@
 rict';%0A%0A
-var
+const
  PORT = 
@@ -48,19 +48,21 @@
  3000;%0A%0A
-var
+const
  SOURCE_
@@ -76,19 +76,21 @@
 ./app';%0A
-var
+const
  BUILD_D
@@ -103,19 +103,21 @@
 dist';%0A%0A
-var
+const
  _ = req
@@ -132,19 +132,21 @@
 dash');%0A
-var
+const
  babelif
@@ -170,19 +170,21 @@
 lify');%0A
-var
+const
  brfs = 
@@ -196,27 +196,29 @@
 re('brfs');%0A
-var
+const
  browserify 
@@ -238,27 +238,29 @@
 owserify');%0A
-var
+const
  browserifyS
@@ -293,19 +293,21 @@
 shim');%0A
-var
+const
  browser
@@ -336,21 +336,32 @@
 r-sync')
-;%0Avar
+.create();%0Aconst
  del = r
@@ -375,19 +375,21 @@
 'del');%0A
-var
+const
  mainBow
@@ -427,19 +427,21 @@
 iles');%0A
-var
+const
  runSequ
@@ -472,19 +472,21 @@
 ence');%0A
-var
+const
  source 
@@ -519,19 +519,21 @@
 ream');%0A
-var
+const
  watchif
@@ -558,19 +558,21 @@
 ify');%0A%0A
-var
+const
  gulp = 
@@ -588,19 +588,21 @@
 gulp');%0A
-var
+const
  util = 
@@ -787,16 +787,21 @@
 wserSync
+.init
 (%7B%0A    b
@@ -926,11 +926,13 @@
 %7B%0A  
-var
+const
  bun
@@ -1309,41 +1309,15 @@
 ync.
-reload(%7Bstream: true, once: true%7D
+stream(
 ));%0A

Use const and BrowserSync 2 methods in gulpfile.