"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = webpackBuild;

var _webpack = require("webpack");

var _statsConfig = require("./statsConfig");

var _webpackConfig = _interopRequireDefault(require("./webpackConfig"));

var _logger = require("../../../logger");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function webpackBuild(options) {
  const config = (0, _webpackConfig.default)(options);
  (0, _webpack.webpack)(config, (err, stats) => {
    if (err || stats.hasErrors()) {
      (0, _logger.errorLogger)('err', err);
    }

    (0, _logger.messageLogger)(stats.toString((0, _statsConfig.statsConfig)(options)));
  });
}