title: Can I detect if my script is being processed by Webpack?
body: <p>I'm trying to use isomorphic rendering in React so I can output static HTMLs as documentation for my application.</p>
  
  <p>The problem is that I have a particular component that only runs on the client, because it references <code>window</code>. The solution is obvious: Not to render it on the server. Yes, I can not to render it on the server, but still, I need it to be included in my <code>webpack</code> bundle so I can render it on the client. The problem is that, the code that prevents my component from rendering on the server is:</p>
  
  <pre><code>function isServer() {
      return ! (typeof window != 'undefined' &amp;&amp; window.document);
  }
  </code></pre>
  
  <p>But <code>isServer()</code> is also <code>true</code> when <code>webpack</code> is bundling, and I want it to work normally while <code>webpack</code> is running.</p>
  
  <p>So, how do I detect that <code>webpack</code> is running?</p>
  
  <p>I'm looking for something like this:</p>
  
  <pre><code>function isWebpack() {
      // what do I put here?
  }
  </code></pre>
  
  <p>Now I can render my client-only component normally if <code>isServer()</code> and <code>!isWebpack()</code>.</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is the component I'm trying to build:</p>
  
  <pre><code>function isServer() {
      return ! (typeof window != 'undefined' &amp;&amp; window.document);
  }
  
  import React from 'react';
  
  const LED = React.createClass({
  
      render: function () {
  
          if(!isServer()) {
              var LiveSchemaEditor  = require('../../src/components/LiveSchemaEditor.js');
              return &lt;LiveSchemaEditor /&gt;;
          }
  
          return &lt;div&gt;I AM IN THE SERVER&lt;/div&gt;;
      }
  });
  
  export default LED;
  </code></pre>
  
  <p>What's bugging me is that the <code>webpack</code> bundle includes the content of <code>LiveSchemaEditor.js</code> but it still prints <code>I AM IN THE SERVER</code> while on client. This doesn't make sense.</p>