Skip to content

Commit 8faaa54

Browse files
ivibeEugeneHlushko
authored andcommitted
Change requestRegExp to resourceRegExp IgnorePluginOptions in docs (#2730)
1 parent a263aeb commit 8faaa54

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/content/plugins/ignore-plugin.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ IgnorePlugin prevents generation of modules for `import` or `require` calls matc
1111

1212
## Using regular expressions
1313

14-
- `requestRegExp`: A RegExp to test the request against.
14+
- `resourceRegExp`: A RegExp to test the resource against.
1515
- `contextRegExp`: (optional) A RegExp to test the context (directory) against.
1616

1717
```javascript
18-
new webpack.IgnorePlugin({requestRegExp, contextRegExp});
18+
new webpack.IgnorePlugin({resourceRegExp, contextRegExp});
1919
// old way, deprecated in webpack v5
20-
new webpack.IgnorePlugin(requestRegExp, [contextRegExp]);
20+
new webpack.IgnorePlugin(resourceRegExp, [contextRegExp]);
2121
```
2222

2323
## Using filter functions
@@ -42,7 +42,7 @@ new webpack.IgnorePlugin({
4242

4343
As of [moment](https://momentjs.com/) 2.18, all locales are bundled together with the core library (see [this GitHub issue](https://github.com/moment/moment/issues/2373)).
4444

45-
The `requestRegExp` parameter passed to `IgnorePlugin` is not tested against the resolved file names or absolute module names being imported or required, but rather against the _string_ passed to `require` or `import` _within the source code where the import is taking place_. For example, if you're trying to exclude `node_modules/moment/locale/*.js`, this won't work:
45+
The `resourceRegExp` parameter passed to `IgnorePlugin` is not tested against the resolved file names or absolute module names being imported or required, but rather against the _string_ passed to `require` or `import` _within the source code where the import is taking place_. For example, if you're trying to exclude `node_modules/moment/locale/*.js`, this won't work:
4646

4747
```diff
4848
-new webpack.IgnorePlugin(/moment\/locale\//);
@@ -58,7 +58,7 @@ require('./locale/' + name);
5858

5959
```javascript
6060
new webpack.IgnorePlugin({
61-
requestRegExp: /^\.\/locale$/,
61+
resourceRegExp: /^\.\/locale$/,
6262
contextRegExp: /moment$/
6363
});
6464
```

0 commit comments

Comments
 (0)