How “include” and “exclude” works in webpack loader

后端 未结 2 1623
离开以前
离开以前 2020-12-01 06:10

Update&Answer:

My misunderstand was:

All the imported/required files will be transformed by loader.

However, some

2条回答
  •  失恋的感觉
    2020-12-01 06:52

    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 (whitelist over blacklist) 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.

提交回复
热议问题