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.md
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -308,12 +308,25 @@ module.exports = {
308
308
309
309
## `Rule.use`
310
310
311
-
A list of [UseEntries](#useentry) which are applied to modules. Each entry specifies a loader to be used.
311
+
`[UseEntry] | function`
312
+
313
+
`Rule.use` can be an array of [UseEntry](#useentry) which are applied to modules. Each entry specifies a loader to be used.
312
314
313
315
Passing a string (i.e. `use: [ 'style-loader' ]`) is a shortcut to the loader property (i.e. `use: [ { loader: 'style-loader '} ]`).
314
316
315
317
Loaders can be chained by passing multiple loaders, which will be applied from right to left (last to first configured).
316
318
319
+
`Rule.use` can be a function which receives the object argument describing the module being loaded, and must return an array of `UseEntry`.
320
+
321
+
The object parameter has the following fields:
322
+
323
+
-`compiler`: The current webpack compiler (can be undefined)
324
+
-`issuer`: The path to the module that is importing the module being loaded
325
+
-`realResource`: Always the path to the module being loaded
326
+
-`resource`: The path to the module being loaded, it is usually equal to `realResource` except when the resource name is overwritten via `!=!` in request string
327
+
328
+
The same shortcut as an array can be used for the return value (i.e. `use: [ 'style-loader' ]`).
0 commit comments