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
docs(config): clarify issuer and resourceQuery documentation
These options were a bit ambiguous and linked back to section that didn't explain
them too much further in detail. We could likely clean this section up even further
but this should at least remove the confusion around these two options.
Resolves#1645Resolves#1646
Copy file name to clipboardExpand all lines: src/content/configuration/module.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ There are two input values for the conditions:
50
50
51
51
2. The issuer: An absolute path to the file of the module which requested the resource. It's the location of the import.
52
52
53
-
**Example:** When we `import "./style.css"` from`app.js`, the resource is `/path/to/style.css` and the issuer is `/path/to/app.js`.
53
+
**Example:** When we `import './style.css'` within`app.js`, the resource is `/path/to/style.css` and the issuer is `/path/to/app.js`.
54
54
55
55
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.
56
56
@@ -115,7 +115,15 @@ Inline loaders and `!` prefixes should not be used as they are non-standard. The
115
115
116
116
## `Rule.issuer`
117
117
118
-
A [`Condition`](#condition) matched with the issuer. See details in [`Rule` conditions](#rule-conditions).
118
+
A [`Condition`](#condition) to match against the module that issued the request. In the following example, the `issuer` for the `a.js` request would be the path to the `index.js` file.
119
+
120
+
__index.js__
121
+
122
+
```js
123
+
importAfrom'./a.js'
124
+
```
125
+
126
+
This option can be used to apply loaders to the dependencies of a specific module or set of modules.
119
127
120
128
121
129
## `Rule.loader`
@@ -146,7 +154,7 @@ An array of [`Rules`](#rule) from which only the first matching Rule is used whe
146
154
resourceQuery:/external/, // foo.css?external
147
155
use:'file-loader'
148
156
}
149
-
]
157
+
]
150
158
}
151
159
```
152
160
@@ -194,16 +202,17 @@ A [`Condition`](#condition) matched with the resource. You can either supply a `
194
202
195
203
## `Rule.resourceQuery`
196
204
197
-
A [`Condition`](#condition) matched with the resource query. The condition matches against a string that starts with a question mark (`"?exampleQuery"`). See details in [`Rule` conditions](#rule-conditions).
205
+
A [`Condition`](#condition) matched with the resource query. This option is used to test against the query section of a request string (i.e. from the question mark onwards). If you were to `import Foo from './foo.css?inline'`, the following condition would match:
198
206
199
-
```javascript
207
+
```js
200
208
{
201
209
test:/.css$/,
202
-
resourceQuery:/inline/,// foo.css?inline
210
+
resourceQuery:/inline/,
203
211
use:'url-loader'
204
212
}
205
213
```
206
214
215
+
207
216
## `Rule.rules`
208
217
209
218
An array of [`Rules`](#rule) that is also used when the Rule matches.
0 commit comments