title: Net.createConnection is not a function Node Js with React
body: <p>My project is on React js with Node Js. I'm trying to connect to DB, but ending up with error as mentioned below: 
  <b>Uncaught TypeError: Net.createConnection is not a function</b></p>
  
  <p>And here is my connection code : </p>
  
  <pre><code>var mysql      = require('mysql');
  var connection = mysql.createConnection({
        host     : 'localhost',
        user     : 'xx',
        password : 'xx',
        database : 'xx'
      });
  
  connection.connect();
  </code></pre>
  
  <p>And here is my webpack config : </p>
  
  <pre><code>var config = {
     entry: './main.jsx',
  
     output: {
        path:'./',
        publicPath: '/',
        filename: 'index.js',
     },
  
     devServer: {
        inline: true,
        host: '0.0.0.0',
        port: '8080',
        historyApiFallback: true
     },
  
     node : {
        fs: "empty", 
        tls: "empty",
        net: "empty"
     },
  
     module: {
        rules: [
           {
              test: /\.json$/,
              use: 'json-loader'
           }
        ],
        loaders: [
           {
              test: /\.(jsx)?$/,
              exclude: /node_modules/,
              loader: 'babel',
  
              query: {
                 presets: ['es2015', 'react']
              }
           },
           {
              test: /\.(png|jpg)?$/,
              loader: require.resolve("file-loader")
           }
        ]
     }
  }
  
  module.exports = config;
  </code></pre>
  
  <p>Please help me out with this problem, tried all the possible options from internet but couldn't find the solution. </p>