title: Getting "Error: Plugin/Preset files are not allowed to export objects, only functions." from babel-preset-react-app/index.js
body: <p>So I have a project that was bootstrapped with <code>create-react-app</code> and when trying to build with <code>react-scripts build</code>, I receive the following error output:</p>
  
  <p><code>Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions.</code></p>
  
  <p>According to the output, the error is coming from <code>node_modules/babel-preset-react-app/index.js</code> which looks like the following:</p>
  
  <pre><code>'use strict';
  
  const create = require('./create');
  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  
  module.exports = create(env);
  </code></pre>
  
  <p>I am using Babel 7 and below is a list of the relevant dependency packages from <code>package.json</code>:</p>
  
  <pre><code>"dependencies": {
      ...
      "react": "^16.5.2",
      "react-dom": "^16.4.0",
      "react-loadable": "^5.4.0",
      "react-router-dom": "^4.3.1",
      "react-scripts": "1.1.5"
  },
  "devDependencies": {
      "@babel/cli": "^7.1.0",
      "@babel/core": "^7.1.0",
      "@babel/preset-env": "^7.1.0",
      "@babel/preset-flow": "^7.0.0",
      "@babel/preset-react": "^7.0.0",
      "babel-core": "^7.0.0-bridge.0",
      "babel-eslint": "^9.0.0"
      ...
  }
  </code></pre>
  
  <p>My <code>babel.config.js</code> is the following:</p>
  
  <pre><code>module.exports({
   presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-flow']
  })
  </code></pre>
  
  <p>I have done as much digging through the internet as I could to try and resolve this problem. Ended up finding many similar posts to this but, none of the suggested solutions worked out for me. I saw one or two that mentioned including the <code>@babel/preset-env</code> and <code>@babel/preset-react</code> presets in <code>babel.config.js</code> which I already have. Hoping the community has some insight to share.</p>