title: Babel window._interopRequireDefault is not a function
body: <p>I have this file:</p>
  
  <p><strong><em>AxiosExtension.js</em></strong></p>
  
  <pre><code>import Axios from 'axios';
  //eventually add code here, if I can get this simple file working
  export default Axios;
  </code></pre>
  
  <p>I am running AxiosExtension through webpack babel loader that looks like this:</p>
  
  <p><strong><em>Webpack Babel-Loader</em></strong></p>
  
  <pre><code>   {
          test: /\.js$/,
          loader: 'babel-loader',
          include: [
              path.join(__dirname, '../../AxiosExtension'),
          ]
      },
  </code></pre>
  
  <p>I am including AxiosExtension in multiple files like this:</p>
  
  <p><strong><em>MyCode.js</em></strong></p>
  
  <pre><code>import Axios from 'path/to/file/AxiosExtension';
  </code></pre>
  
  <p>When I load MyCode.js in the browers after building my webpack, I get this error:</p>
  
  <p><strong><em>Console Error</em></strong></p>
  
  <pre><code>Uncaught TypeError: window._interopRequireDefault is not a function
  </code></pre>
  
  <p>When I view my AxiosExtension.js file in Chrome Sources tab, here is what babel has output:</p>
  
  <p><strong><em>AxiosExtension.js Final Output after Babel</em></strong></p>
  
  <pre><code>'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _axios = require('axios');
  
  window._axios2 = window._interopRequireDefault(_axios);
  
  window._interopRequireDefault = function(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
  
  exports.default = window._axios2.default;
  </code></pre>
  
  <p>Looks like <code>_interopRequireDefault</code> is defined after it is used. Any ideas about what might be wrong with my config of webpack/babel? </p>
  
  <p><strong><em>.babelrc</em></strong></p>
  
  <pre><code>{
    "presets": ["es2015"]
  }
  </code></pre>