Skip to content

Commit e8ecd8e

Browse files
committed
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 #1645 Resolves #1646
1 parent 6d8cd59 commit e8ecd8e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/content/configuration/module.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ There are two input values for the conditions:
5050

5151
2. The issuer: An absolute path to the file of the module which requested the resource. It's the location of the import.
5252

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`.
5454

5555
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.
5656

@@ -115,7 +115,15 @@ Inline loaders and `!` prefixes should not be used as they are non-standard. The
115115

116116
## `Rule.issuer`
117117

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+
import A from './a.js'
124+
```
125+
126+
This option can be used to apply loaders to the dependencies of a specific module or set of modules.
119127

120128

121129
## `Rule.loader`
@@ -146,7 +154,7 @@ An array of [`Rules`](#rule) from which only the first matching Rule is used whe
146154
resourceQuery: /external/, // foo.css?external
147155
use: 'file-loader'
148156
}
149-
]
157+
]
150158
}
151159
```
152160

@@ -194,16 +202,17 @@ A [`Condition`](#condition) matched with the resource. You can either supply a `
194202

195203
## `Rule.resourceQuery`
196204

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:
198206

199-
```javascript
207+
``` js
200208
{
201209
test: /.css$/,
202-
resourceQuery: /inline/, // foo.css?inline
210+
resourceQuery: /inline/,
203211
use: 'url-loader'
204212
}
205213
```
206214

215+
207216
## `Rule.rules`
208217

209218
An array of [`Rules`](#rule) that is also used when the Rule matches.

0 commit comments

Comments
 (0)