title: How to resolve fs.existsSync is not a function
body: <p>In NodeJS I have:</p>
  
  <pre><code>const fs = require('fs');
  if (!fs.existsSync("some_path")) {
  ...
  }
  </code></pre>
  
  <p>But I get the error:</p>
  
  <blockquote>
    <p>TypeError: fs.existsSync is not a function</p>
  </blockquote>
  
  <p>After doing some searching, I read that <code>Webpack</code> brings its own <code>require</code> which clobbers <code>node.js</code>'s <code>require</code>, so when you require a <code>node.js</code> core module that <code>webpack</code> can't resolve to one of your files or dependencies, it throws.</p>
  
  <p>(My stack trace includes <code>__webpack_require__</code>)</p>
  
  <p>But how can I fix it?</p>