"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Webpack = require("webpack");
const defaultWebpackConfig_1 = require("./defaultWebpackConfig");
const logErrors_1 = require("./logErrors");
function bundleFileOrExit(cwd, input, output, logger, extendConfiguration) {
    const defaultConfig = defaultWebpackConfig_1.defaultWebpackConfig(cwd, input, output);
    const extendedConfiguration = Object.assign({}, extendConfiguration(defaultConfig));
    extendedConfiguration.entry = defaultConfig.entry;
    extendedConfiguration.output = defaultConfig.output;
    const compiler = Webpack(extendedConfiguration);
    const logError = logErrors_1.logErrors(logger);
    return new Promise((resolve, reject) => compiler.run((err, stats) => (logError(err, stats, reject), resolve())));
}
exports.bundleFileOrExit = bundleFileOrExit;
//# sourceMappingURL=bundleFileOrExit.js.map