title: webpack to bundle code targeting node.js
body: <p>I use <code>webpack</code> for bundling the client side and want to use it for building node/npm library. I saw I can specify the target as <code>node</code> for this. From the <a href="http://webpack.github.io/docs/configuration.html">doc</a>,</p>
  
  <pre><code>"node" Compile for usage in a node.js-like environment (use require to load chunks)
  </code></pre>
  
  <p>But the problem is <code>react.js</code> is bundled in the compile output. I want only my source files and any dependencies listed in <code>package.json</code> to be included. I have specified react as peerDependency, like</p>
  
  <pre><code>"peerDependencies": {
      "react": "&gt;=0.13",
      "react-tap-event-plugin": "&gt;=0.1.3"
    },
  </code></pre>
  
  <p>I also try defining react in <code>externals</code> expecting it may just create the symbol and not include the library itself, but it still includes <code>react</code> in compiled output.</p>
  
  <pre><code> target: "node",
      externals: [{
          'react' : 'React',
      }]
  </code></pre>
  
  <p>so, is there a way to use <code>webpack</code> to bundle by server side / node code, but also to specify not to bundle some of the dependencies (which may be defined as <code>peerDependencies</code> or <code>devDependencies</code>)?</p>