The problem is that without that exclude
(or an include
) webpack would traverse through the dependencies when you point to them at your code and process them. Even though that could work, it would come with a heavy performance penalty.
I prefer to set up an include
myself (allowlist over denylist/blocklist) as that gives me more control over the behavior. I include
my application directory and then add more items to the include
based on the need. This allows me to make exceptions easily and process bits from node_modules
if absolutely needed.