Most of the question asking on the site is to how to exclude node_modules but instead, I'm wondering why would we want to exclude node_modules?
module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['@babel/preset-env']
}
}
]
}
};
Can anyone explain to me to the reason behind excluding node_modules?