"use strict";

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

var _webpack = _interopRequireDefault(require("webpack"));

var _compression = _interopRequireDefault(require("compression"));

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

function webpackConfig(mode, app) {
  let config;

  if (mode === 'prod') {
    config = require('../../../src/configs/webpack.prod.config');
    app.use((0, _compression.default)());
  } else if (mode === 'dev' || mode === 'dev-no-warn') {
    config = require('../../../src/configs/webpack.dev.config');
  } else {
    throw new Error('You must configure valid option in mode');
  } // console.log({ contextURL });


  let compiler = (0, _webpack.default)(config);
  return {
    config,
    compiler
  };
}