"use strict";

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

var _lodash = _interopRequireDefault(require("lodash"));

var _resolve = _interopRequireDefault(require("@reactant/core/resolve"));

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

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

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

function _default(config) {
  var _config$babel;

  return _objectSpread({}, config, {
    babel: _objectSpread({}, config.babel, {
      plugins: _lodash.default.uniq([(0, _resolve.default)('react-hot-loader/babel', __dirname), ...((config === null || config === void 0 ? void 0 : (_config$babel = config.babel) === null || _config$babel === void 0 ? void 0 : _config$babel.plugins) || [])])
    }),
    ignore: _objectSpread({}, config.ignore, {
      warnings: [..._lodash.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: _objectSpread({}, config.ports, {
      storybook: null
    }),
    paths: _objectSpread({}, config.paths, {
      stories: 'stories',
      storybook: '{reactant}/storybook'
    }),
    webpack: {}
  }, storybook ? {
    storybook: {}
  } : {});
}