"use strict";

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

var _utils = require("../utils");

var _babelPresetReactOption = _interopRequireDefault(require("./babel-option-utils/babel-preset-react-option"));

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

const {
  module: {
    mode
  },
  babelCustomizationForLibrary: {
    babelPlugins
  },
  enableTypeScript,
  alias
} = (0, _utils.getOptions)();
const isProd = mode.toLowerCase() === 'prod';
const defaultPlugins = [[require.resolve('babel-plugin-transform-define'), isProd ? {
  __DOCS__: false
} : {}], require.resolve('@babel/plugin-syntax-dynamic-import'), [require.resolve('babel-plugin-module-resolver'), {
  "root": ["./"],
  alias
}]];
const resolvedPlugins = [];
babelPlugins.forEach(plugin => {
  resolvedPlugins.push(require.resolve(plugin));
});
const plugins = [...defaultPlugins, ...resolvedPlugins];
const presets = [require.resolve('@babel/preset-env'), (0, _babelPresetReactOption.default)({
  disableES5Transpile: false
})];

if (enableTypeScript) {
  presets.push(require.resolve('@babel/preset-typescript'));
}

var _default = () => ({
  presets: presets,
  plugins: plugins
});

exports.default = _default;