import * as Webpack from 'webpack';
import { defaultWebpackConfig } from './defaultWebpackConfig';
import { logErrors } from './logErrors';
export function bundleFileOrExit(cwd, input, output, logger, extendConfiguration) {
    const defaultConfig = 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(logger);
    return new Promise((resolve, reject) => compiler.run((err, stats) => (logError(err, stats, reject), resolve())));
}
//# sourceMappingURL=bundleFileOrExit.js.map