'use strict';

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

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _lodash = require('lodash');

var _lodash2 = _interopRequireDefault(_lodash);

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

const storybook = _lodash2.default.includes(process.argv, '-s') || _lodash2.default.includes(process.argv, '--storybook');

function _default(config) {
  return _extends({}, config, {
    babel: _extends({}, config.babel, {
      presets: [...config.babel.presets, require.resolve('babel-preset-react')],
      plugins: [require.resolve('react-hot-loader/babel'), ...config.babel.plugins]
    }),
    ignore: _extends({}, config.ignore, {
      warnings: [..._lodash2.default.get(config, 'ignore.warnings', []), '/(express\\/lib\\/view)|(colors\\/lib\\/colors)|(bindings\\/bindings)|' + '(deasync\\/index)|(parse5\\/lib\\/index)|(ejs\\/lib\\/ejs)\\.js.*' + '(Critical dependency: the request of a dependency is an expression)|' + '(require\\.extensions is not supported by webpack\\. Use a loader instead\\.)/']
    }),
    ports: _extends({}, config.ports, {
      storybook: null
    }),
    paths: _extends({}, config.paths, {
      stories: 'stories',
      storybook: '{reactant}/storybook'
    }),
    webpack: _webpack => _webpack
  }, storybook ? { storybook: webpack => webpack } : {});
}
exports.default = _default;