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: content/configuration/module.md
+15-18Lines changed: 15 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ These options determine how the [different types of modules](/concepts/modules)
12
12
13
13
`RegExp | [RegExp]`
14
14
15
-
Prevent webpack from parsing any files matching the given regular expression(s). Ignored files **should not** have calls to `import`, `require`, `define` or any other importing mechanism. This can boost build performance when ignoring large libraries...
15
+
Prevent webpack from parsing any files matching the given regular expression(s). Ignored files **should not** have calls to `import`, `require`, `define` or any other importing mechanism. This can boost build performance when ignoring large libraries.
16
16
17
17
```js
18
18
noParse:/jquery|backbone/
@@ -25,35 +25,33 @@ noParse: /jquery|backbone/
25
25
An array of [Rules](#rule) which are matched to requests when modules are created. These rules can modify how the module is created. They can apply loaders to the module, or modify the parser.
26
26
27
27
28
-
## `Rule`
28
+
## Rule
29
29
30
-
A Rule can be separated into three parts: Conditions, Results and nested Rules.
30
+
A Rule can be separated into three parts — Conditions, Results and nested Rules.
31
31
32
-
### `Rule` conditions
32
+
### Rule conditions
33
33
34
34
There are two input values for the conditions:
35
35
36
-
The resource: An absolute path to the file requested. It's already resolved according the [`resolve` rules](/configuration/resolve).
36
+
1.The resource: An absolute path to the file requested. It's already resolved according the [`resolve` rules](/configuration/resolve).
37
37
38
-
The issuer: An absolute path to the file of the module which requested the resource. It's the location of the import.
38
+
2.The issuer: An absolute path to the file of the module which requested the resource. It's the location of the import.
39
39
40
-
**Example:** The `import "./style.css"` from `app.js`:
41
-
42
-
Resource is `/path/to/style.css`. Issuer is `/path/to/app.js`.
40
+
**Example:** When we `import "./style.css"` from `app.js`, the resource is `/path/to/style.css` and the issuer is `/path/to/app.js`.
43
41
44
42
In a Rule the properties [`test`](#rule-test), [`include`](#rule-include), [`exclude`](#rule-exclude) and [`resource`](#rule-resource) are matched with the resource and the property [`issuer`](#rule-issuer) is matched with the issuer.
45
43
46
44
When using multiple conditions, all conditions must match.
47
45
48
-
### `Rule` results
46
+
### Rule results
49
47
50
-
Rule results are only used when the Rule condition matches.
48
+
Rule results are used only when the Rule condition matches.
51
49
52
50
There are two output values of a Rule:
53
51
54
-
The applied loaders: An array of loaders applied to the resource. Separated in pre-, post- and normal loaders.
52
+
1. Applied loaders: An array of loaders applied to the resource.
55
53
56
-
The parser options: An object with options which should be used to create the parser for this module.
54
+
2. Parser options: An options object which should be used to create the parser for this module.
57
55
58
56
These properties affect the loaders: [`loader`](#rule-loader), [`options`](#rule-options-rule-query), [`use`](#rule-use).
59
57
@@ -64,16 +62,15 @@ The [`enforce`](#rule-enforce) property affect the loader category. Whether it's
64
62
The [`parser`](#rule-parser) property affect the parser options.
65
63
66
64
67
-
## `Rule` nested rules
68
-
69
-
With the properties [`rules`](#rule-rules) and [`oneOf`](#rule-oneof) nested rules can be specified.
65
+
## Nested rules
70
66
71
-
Nested rules are used when the Rule condition matches.
67
+
Nested rules can be specified under the properties [`rules`](#rule-rules) and [`oneOf`](#rule-oneof).
72
68
69
+
These rules are evaluated when the Rule condition matches.
73
70
74
71
## `Rule.enforce`
75
72
76
-
Either `"pre"`, `"post"` or no value.
73
+
Possible values: `"pre" | "post"`
77
74
78
75
Specifies the category of the loader. No value means normal loader.
0 commit comments