title: Uncaught TypeError: fs.exists is not a function
body: <p>I am having trouble with the fs module error in Node JS Application. I am using Webpack also,</p>
  
  <p>My .js file:</p>
  
  <pre><code>const fs = require('fs');
  const path = require('path');
  
  const filePath = path.join(__dirname, '../../app/logs/logs.txt');
  
  module.exports.displayInfo = (info, containerID = 'info-dock') =&gt; {
    fs.exists(filePath, (exists) =&gt; {
      if (exists) {
        console.log('Present');
      }
    });
    let message;
    if (info.message) {
      message = info.message;
    } else {
      message = 'No message supplied.';
    }
  
  };
  </code></pre>
  
  <p>My webpack config file :</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: './clientSide/index.js',
    cache: true,
    output: {
      path: path.resolve(__dirname, './public/js/'),
      filename: 'bundle.js',
    },
    module: {
      loaders: [
        {
          test: /\.js$/,
          loader: 'babel-loader',
          exclude: /node_modules/,
          query: {
            presets: ['env'],
          },
        },
      ],
    },
    devtool: 'source-map',
    target: 'web',
    node: {
      fs: "empty"
    }
  };
  </code></pre>
  
  <p>When I am trying to run and call displayInfo method in my application, on the browser's console, I get an error: ncaught TypeError: fs.exists is not a function.</p>
  
  <p>Does anybody know how to correct this?</p>