In webpack.config.js
to determine module we can use 3 different attributes:
...
module:{
rules: [
{
test: ... // the first one, commonly used in most example we can found on internet
include: ... // the second one
resource: ... // the third one
use: ['style-loader','css-loader'],
},
...
],
...
}
Docs are not explanatory about them:
Rule.test
Include all modules that pass test assertion. If you supply aRule.test
option, you cannot also supply aRule.resource
. SeeRule.resource
andCondition.test
for details.
Rule.include
Include all modules matching any of these conditions. If you supply aRule.include
option, you cannot also supply aRule.resource
. SeeRule.resource
andCondition.include
for details.
Rule.resource
ACondition
matched with the resource. See details inRule
conditions.
Each of them are Condition
type. Some of them are mutually exclusive. But what is the purpose of each? When we should use each?
If there will be only test
everything would be clear.