const addExports = require('babel-plugin-add-module-exports')
const babelEnv = require('@babel/preset-env')
const flow = require('@babel/preset-flow')
const react = require('@babel/preset-react')
const reactRequire = require('babel-plugin-react-require').default
const lodash = require('babel-plugin-lodash')
const reactDisplayName = require('@babel/plugin-transform-react-display-name')
const classProperties = require('@babel/plugin-proposal-class-properties')
const exportFrom = require('@babel/plugin-proposal-export-namespace-from')

const browsers = require('./constants').BROWSER_SUPPORT

module.exports = function (env) {
  const plugins = [
    addExports,
    classProperties,
    exportFrom,
    lodash,
    reactDisplayName,
    reactRequire
  ]

  return {
    plugins,
    presets: [
      [
        babelEnv,
        {
          loose: false, // Loose mode breaks spread operator on `Set`s
          targets: { browsers },
          useBuiltIns: 'usage'
        }
      ],
      flow,
      react
    ]
  }
}

const addExports = require('babel-plugin-add-module-exports')
const babelEnv = require('@babel/preset-env')
const flow = require('@babel/preset-flow')
const react = require('@babel/preset-react')
const reactRequire = require('babel-plugin-react-require').default
const lodash = require('babel-plugin-lodash')
const reactDisplayName = require('@babel/plugin-transform-react-display-name')
const transformRuntime = require('@babel/plugin-transform-runtime')
const classProperties = require('@babel/plugin-proposal-class-properties')
const exportFrom = require('@babel/plugin-proposal-export-namespace-from')

const browsers = require('./constants').BROWSER_SUPPORT

module.exports = function (env) {
  const plugins = [
    addExports,
    classProperties,
    exportFrom,
    lodash,
    reactDisplayName,
    reactRequire,
    transformRuntime
  ]

  return {
    plugins,
    presets: [
      [
        babelEnv,
        {
          loose: false, // Loose mode breaks spread operator on `Set`s
          targets: { browsers }
        }
      ],
      flow,
      react
    ]
  }
}

--- 
+++ 
@@ -5,7 +5,6 @@
 const reactRequire = require('babel-plugin-react-require').default
 const lodash = require('babel-plugin-lodash')
 const reactDisplayName = require('@babel/plugin-transform-react-display-name')
-const transformRuntime = require('@babel/plugin-transform-runtime')
 const classProperties = require('@babel/plugin-proposal-class-properties')
 const exportFrom = require('@babel/plugin-proposal-export-namespace-from')
 
@@ -18,8 +17,7 @@
     exportFrom,
     lodash,
     reactDisplayName,
-    reactRequire,
-    transformRuntime
+    reactRequire
   ]
 
   return {
@@ -29,7 +27,8 @@
         babelEnv,
         {
           loose: false, // Loose mode breaks spread operator on `Set`s
-          targets: { browsers }
+          targets: { browsers },
+          useBuiltIns: 'usage'
         }
       ],
       flow,
refactor(babel): Remove direct transform runtime requirement and turn on the userBuiltIns flag for b
