<commit_before>'use strict';

const env = process.env.BABEL_ENV || process.env.NODE_ENV;

const plugins = [
  [require.resolve('react-loadable/babel'), { webpack: true, babel: true }],
  require.resolve('babel-plugin-transform-class-properties'),
  [
    require.resolve('babel-plugin-transform-object-rest-spread'),
    {
      useBuiltIns: true,
    },
  ],
  [
    require.resolve('babel-plugin-transform-react-jsx'),
    {
      useBuiltIns: true,
    },
  ],
  [
    require.resolve('babel-plugin-transform-runtime'),
    {
      helpers: false,
      polyfill: false,
      regenerator: true,
    },
  ],
  require.resolve('babel-plugin-idx'),
  require.resolve('babel-plugin-syntax-dynamic-import'),
];

if (env === 'development' || env === 'test') {
  const devPlugins = [
    require.resolve('babel-plugin-transform-react-jsx-source'),
    require.resolve('babel-plugin-transform-react-jsx-self'),
  ];

  plugins.push(...devPlugins);
}

const clientEnvPresets = [
  [
    require.resolve('babel-preset-env'),
    {
      modules: false,
      targets: {
        ie: 10,
        // We currently minify with uglify
        // Remove after https://github.com/mishoo/UglifyJS2/issues/448
        uglify: true,
      },
      // Disable polyfill transforms
      useBuiltIns: false,
      // Do not transform modules to CJS
      modules: false,
    },
  ],
];

const serverEnvPresets = [
  [
    require.resolve('babel-preset-env'),
    {
      modules: false,
      targets: {
        node: 'current',
      },
      // Disable polyfill transforms
      useBuiltIns: false,
      // Do not transform modules to CJS
      modules: false,
    },
  ],
];

const serverPlugins = [require.resolve('babel-plugin-dynamic-import-node')];

module.exports = {
  env: {
    client: {
      presets: [require.resolve('babel-preset-react'), ...clientEnvPresets],
      plugins: [
        ...plugins,
        [require.resolve('babel-plugin-transform-regenerator'), { async: false }],
      ],
    },
    server: {
      presets: [require.resolve('babel-preset-react'), ...serverEnvPresets],
      plugins: [...plugins, ...serverPlugins],
    },
  },
};<commit_msg>🐛 transform es6 modules in test environment<commit_after>'use strict';

const env = process.env.BABEL_ENV || process.env.NODE_ENV;

const plugins = [
  [require.resolve('react-loadable/babel'), { webpack: true, babel: true }],
  require.resolve('babel-plugin-transform-class-properties'),
  [
    require.resolve('babel-plugin-transform-object-rest-spread'),
    {
      useBuiltIns: true,
    },
  ],
  [
    require.resolve('babel-plugin-transform-react-jsx'),
    {
      useBuiltIns: true,
    },
  ],
  [
    require.resolve('babel-plugin-transform-runtime'),
    {
      helpers: false,
      polyfill: false,
      regenerator: true,
    },
  ],
  require.resolve('babel-plugin-idx'),
  require.resolve('babel-plugin-syntax-dynamic-import'),
];

if (env === 'development' || env === 'test') {
  const devPlugins = [
    require.resolve('babel-plugin-transform-react-jsx-source'),
    require.resolve('babel-plugin-transform-react-jsx-self'),
  ];

  plugins.push(...devPlugins);
}

const clientEnvPresets = [
  [
    require.resolve('babel-preset-env'),
    {
      targets: {
        ie: 10,
        // We currently minify with uglify
        // Remove after https://github.com/mishoo/UglifyJS2/issues/448
        uglify: true,
      },
      // Disable polyfill transforms
      useBuiltIns: false,
      // Do not transform modules to CJS
      modules: false,
    },
  ],
];

const serverEnvPresets = [
  [
    require.resolve('babel-preset-env'),
    {
      targets: {
        node: 'current',
      },
      // Disable polyfill transforms
      useBuiltIns: false,
      // Do not transform modules to CJS in non test env
      modules: env === 'test' ? undefined : false,
    },
  ],
];

const serverPlugins = [require.resolve('babel-plugin-dynamic-import-node')];

module.exports = {
  env: {
    client: {
      presets: [require.resolve('babel-preset-react'), ...clientEnvPresets],
      plugins: [
        ...plugins,
        [require.resolve('babel-plugin-transform-regenerator'), { async: false }],
      ],
    },
    server: {
      presets: [require.resolve('babel-preset-react'), ...serverEnvPresets],
      plugins: [...plugins, ...serverPlugins],
    },
  },
};
{'fraction_non_alphanumeric': 0.16064441887226696, 'fraction_numerical': 0.002991944764096663, 'mean_word_length': 2.5419722901385495, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5678778', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1373, 'n_words': 233}