'Why is webpack processing my node_modules folder?

... despite my configuration file telling it not to. It is a simple file only handling a few file types as seen below. I am using webpack 5.7.0, the current latest version.

const jsx = {
  test: /\.jsx?/,
  exclude: /node_modules/,
  use: {
    loader: 'babel-loader',
    options: {
      presets: ['@babel/preset-react']
    }
  }
};

const file_types = {
  rules: [
    jsx
  ]
};

const entry = '/Users/c/top/tiny/index.jsx';

const output = {
  filename: 'bundle.js',
  path: '/Users/c/top/tiny/dist'
};

const config_obj = {
  entry:          entry,
  output:         output,
  module:         file_types
};

module.exports = (env) => {
  return config_obj;
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source