Skip to content

Commit 2351d04

Browse files
authored
docs(configuration): add Rule.compiler (#7392)
1 parent 688db18 commit 2351d04

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/content/configuration/module.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,33 @@ import one from './pkg-1.json' assert { type: 'json' };
751751

752752
In this example, `Rule.assert` is used to apply `loader-assert.js` to any module imported with the assertion `assert { type: "json" }`, ensuring that JSON files are processed correctly.
753753

754+
## Rule.compiler
755+
756+
A [`Condition`](#condition) that allows you to match the child compiler name.
757+
758+
**webpack.config.js**
759+
760+
```javascript
761+
module.exports = {
762+
// ...
763+
name: "compiler"
764+
module: {
765+
rules: [
766+
{
767+
test: /a\.js$/,
768+
compiler: "compiler", // Matches the "compiler" name, loader will be applied
769+
use: "./loader"
770+
},
771+
{
772+
test: /b\.js$/,
773+
compiler: "other-compiler", // Does not match the "compiler" name, loader will NOT be applied
774+
use: "./loader"
775+
}
776+
]
777+
},
778+
};
779+
```
780+
754781
## Rule.enforce
755782

756783
`string`

0 commit comments

Comments
 (0)