var gulp = require("gulp");
var util = require("gulp-util");
var rename = require("gulp-rename");
var run_sequence = require("run-sequence");

const PORT = process.env.PORT || 8080;

gulp.task("prebuild", (callback) => {
    run_sequence("copy_index", callback);
});

gulp.task("build", (callback) => {
    run_sequence("prebuild", "webpack", callback);
});

gulp.task("dev", (callback) => {
    run_sequence("prebuild", "webpack_dev_server", callback);
});

gulp.task("copy_index", () => {
    return gulp.src("src/index.html").pipe(gulp.dest("build"));
});

gulp.task("webpack", (callback) => {
    var webpack = require("webpack");
    var config = require("./webpack.config");
    webpack(config, (err, stats) => {
        if (err) {
            throw new util.PluginError("webpack", err);
        }
        util.log("[webpack]", stats.toString({
            colors: true
        }));
        callback();
    });
});

gulp.task("webpack_dev_server", (callback) => {
    var webpack = require("webpack");
    var webpack_dev_server = require("webpack-dev-server");
    var config = require("./webpack.config");
    config.entry.app.unshift("webpack-dev-server/client?http://localhost:" + PORT + "/");
    var compiler = webpack(config);
    var server = new webpack_dev_server(compiler, {
        contentBase: "build",
        publicPath: config.output.publicPath,
        filename: config.output.filename,
        stats: { colors: true },
        historyApiFallback: true
    }).listen(PORT, "localhost", (err) => {
            if (err) {
                throw new util.PluginError("webpack-dev-server", err);
            }
            callback();
        });
});

@@ -1517,28 +1517,24 @@
 %3E %7B%0A        
-    
 if (err) %7B%0A 
@@ -1524,36 +1524,32 @@
      if (err) %7B%0A
-    
             thro
@@ -1603,34 +1603,26 @@
 r);%0A        
-    %7D%0A    
+%7D%0A
         call
@@ -1629,20 +1629,16 @@
 back();%0A
-    
     %7D);%0A

Fix indentation