Skip to content

Commit b3a81e7

Browse files
simon04skipjack
authored andcommitted
docs(plugins): add IgnorePlugin documentation
Fixes #1014
1 parent 3941db1 commit b3a81e7

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

content/plugins/ignore-plugin.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: IgnorePlugin
3+
contributors:
4+
- simon04
5+
---
6+
7+
```js
8+
new webpack.IgnorePlugin(requestRegExp, [contextRegExp])
9+
```
10+
11+
Don't generate modules for requests matching the provided RegExp.
12+
13+
* `requestRegExp` A RegExp to test the request against.
14+
* `contextRegExp` (optional) A RegExp to test the context (directory) against.
15+
16+
## Typical use-cases
17+
18+
### Ignore moment locales
19+
20+
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)). You can use the `IgnorePlugin` to stop any locale being bundled with moment:
21+
22+
```js
23+
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
24+
```

0 commit comments

Comments
 (0)