var execSync = require("child_process").execSync;
var gulp     = require("gulp");
var eslint   = require("gulp-eslint");
var gutil    = require("gulp-util");
var path     = require("path");
var webpack  = require("webpack");

var build = function (minify, callback) {
    webpack({
        entry: "./src/asteroid.js",
        module: {
            loaders: [{
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loader: "babel"
            }]
        },
        output: {
            libraryTarget: "umd",
            library: "Asteroid",
            path: path.join(__dirname, "/dist"),
            filename: (minify ? "asteroid.min.js" : "asteroid.js")
        },
        plugins: minify ? [
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    warnings: false
                }
            })
        ] : null
    }, function (err, stats) {
        if (err) {
            throw new gutil.PluginError("webpack", err);
        }
        gutil.log("[webpack]", stats.toString({colors: true}));
        callback();
    });
};

gulp.task("build", function (callback) {
    build(false, function () {
        build(true, callback);
    });
});

gulp.task("test", function () {
    execSync("npm test", {
        stdio: [null, process.stdout]
    });
});

gulp.task("lint", function () {
    return gulp.src(["src/**/*.js"])
        .pipe(eslint())
        .pipe(eslint.format());
});

gulp.task("default", ["test", "lint"], function () {
    return gulp.watch(["src/**/*.js", "test/unit/**/*.js"], ["test", "lint"]);
});

@@ -311,16 +311,111 @@
 id.js%22,%0A
+        externals: %7B%0A            %22wolfy87-eventemitter%22: %22umd wolfy87-eventemitter%22%0A        %7D,%0A
         

Set eventemitter as external dependency