title: Webpack import from files that use module.exports
body: <p>I have React app and a file where I want to store things related to api.</p>
  
  <pre><code>const proxy = require('http-proxy-middleware');
  const path = require('path');
  
  //.....
  
  const targetApi = (objectWithUrlEntries) =&gt; {
    Object.keys(objectWithUrlEntries).forEach((key) =&gt; {
      objectWithUrlEntries[key] = path.join('/api/', objectWithUrlEntries[key]);
    });
  };
  
  module.exports.proxyExpressCalls = proxyExpressCalls;
  module.exports.devServerProxyConfig = devServerProxyConfig;
  module.exports.targetApi = targetApi;
  </code></pre>
  
  <p>Some of those things will be used by webpack itself, and some will be used inside the app (to correctly target api calls).</p>
  
  <p>However when I try to import things in my app:</p>
  
  <pre><code>// @flow
  import { buildUrl } from 'data/utils';
  import type { Axios } from './flow.types';
  import { targetApi } from './api';
  
  console.log(targetApi());
  </code></pre>
  
  <p>I get errors. In terminal:</p>
  
  <blockquote>
    <p>WARNING in ./src/data/redux/api/user.js 6:12-21 "export 'targetApi'
    was not found in './api'</p>
  </blockquote>
  
  <p>in browser:</p>
  
  <pre><code>api.js?d669:39 Uncaught TypeError: Cannot set property 'proxyExpressCalls' of undefined
      at Object.eval (api.js?d669:39)
      at eval (api.js:60)
      at Object../src/data/redux/api/api.js (client.bundle.js:11620)
      at __webpack_require__ (client.bundle.js:708)
      at fn (client.bundle.js:113)
      at eval (user.js:15)
      at Object../src/data/redux/api/user.js (client.bundle.js:11668)
      at __webpack_require__ (client.bundle.js:708)
      at fn (client.bundle.js:113)
      at eval (user.js:18)
  </code></pre>
  
  <p>So the problem is that when app is being bundled <code>commonjs</code> exports fail, but if I would use es6 <code>export</code> syntax then <code>Node</code> would fail.</p>