title: WebPack is trying to load all required modules and then breaking
body: <p>I'm using webpack to build a project where the client and server-side share certain concepts (a shared state). Because of this, I've set up webpack to compile <em>both</em> of them, like so:</p>
  
  <pre><code>const path = require('path')
  
  module.exports = [
    {
      entry: './lib/client.js',
      output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'static')
      },
      module: {
        rules: [
          {
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            use: {
              loader: 'babel-loader',
              options: {
                presets: ['babel-preset-env', 'babel-preset-react']
              }
            }
          }
        ]
      }
    },
    {
      entry: './lib/server.js',
      target: 'node',
      output: {
        filename: 'index.js',
        path: path.resolve(__dirname)
      }
    }
  ]
  </code></pre>
  
  <p>Unfortunately, when this compiles, webpack seems to be loading up every <code>require</code>'d module on the server-side and breaking when it can't find them. It's even trying to load some <code>.node</code> modules, which cause it to output a warning.</p>
  
  <p>It finally breaks at this error, probably a result of my server code having <code>require('pg')</code> in it:</p>
  
  <pre><code> ERROR in ./node_modules/pg/lib/native/client.js
      Module not found: Error: Can't resolve 'pg-native' in 'C:\...\node_modules\pg\lib\native'
       @ ./node_modules/pg/lib/native/client.js 10:13-33
       @ ./node_modules/pg/lib/native/index.js
       @ ./node_modules/pg/lib/index.js
       @ ./lib/server.js
  </code></pre>
  
  <p>How do I get it to ignore the required modules and just keep them as regular <code>require</code> calls in the output? <code>target: 'node'</code> doesn't seem to help.</p>
  
  <p><strong>Update:</strong> For whatever reason, trying to build the exact same project on my Linux system works perfectly, so it seems to be a platform-specific problem.</p>