const { isProd, isDev } = require('../env');

module.exports = (config) => {
  const options = {
    babelrc: false,
    compact: true,
    cacheDirectory: `${__dirname}/.babelCache`,

    presets: [
      ['env', {
        loose: true,
        modules: false,
        exclude: ['transform-regenerator'],
      }],
      require.resolve('babel-preset-react'),
    ],

    plugins: [
      // class { handleClick = () => { } }
      'transform-class-properties',
      // { ...todo, completed: true }
      ['transform-object-rest-spread', {
        useBuiltIns: true,
      }],
    ],
  };

  if (isProd) {
    options.plugins = [
      'transform-imports',
      'transform-react-constant-elements',
      ['transform-react-remove-prop-types', {
        mode: 'wrap',
      }],
      ...options.plugins,
    ];
  }

  if (isDev) {
    options.plugins = [
      ...options.plugins,
      'react-hot-loader/babel',
    ];
  }

  return options;
};

@@ -250,24 +250,52 @@
 les: false,%0A
+        useBuiltIns: false,%0A
         excl
@@ -326,16 +326,210 @@
 ator'%5D,%0A
+        targets: %7B%0A          browsers: %5B%0A            'last 4 versions',%0A            '%3E 1%25',%0A            'Firefox ESR',%0A            'safari %3E= 7',%0A            'ie %3E= 10',%0A          %5D,%0A        %7D,%0A
       %7D%5D

Add targets option to babel configuration