You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/configuration/module.mdx
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -751,6 +751,33 @@ import one from './pkg-1.json' assert { type: 'json' };
751
751
752
752
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.
753
753
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
0 commit comments