title: How to exclude directory from getting bundled by Webpack?
body: <p><strong>Expected:</strong> </p>
  
  <p>When I build with webpack, all my JS files get bundled except for the files in the ./src/Portfolio directory as per my Webpack.config.js settings.</p>
  
  <p><strong>Actual:</strong></p>
  
  <p>Webpack bundles all the files including the ones in the directory despite the settings and other variations i have provided within webpack.config.js.</p>
  
  <p><strong>Code:</strong></p>
  
  <p>Webpack.config.js</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: './src/index.js',
    devtool: 'source-map',
    mode: 'development',
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: [
            path.resolve(__dirname, './src/Portfolio/')
          ]
        }
      ]
    },
    output: {
      filename: 'main.js',
      path: path.resolve(__dirname, 'dist')
    }
  };
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/iOkzz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iOkzz.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>How can i successfully exclude the ./src/Portfolio directory and its
    contents?</p>
  </blockquote>