title: Error importing superagent in React code
body: <p>I have a NodeJS server code written in JSX where I'm importing superagent like so:</p>
  
  <pre><code>import request from 'superagent';
  </code></pre>
  
  <p>When server starts after build, I get the following error:
  TypeError: require is not a function. And this happens at the following line in my compiled code:</p>
  
  <pre><code>var crypto = require('crypto');
  </code></pre>
  
  <p>On tracing back I realized that crypto is required by 'formidable', which is required by 'superagent'.</p>
  
  <p>I have the same superagent import in my client side javascript code but that works fine. I diffed the compile JS code for node(server), and client, and both are the same. So it doesn't seem like an issue with the way its build.</p>
  
  <p>Has anyone seen this error before and would you know what needs to be done?</p>