@@ -6,11 +6,22 @@ contributors:
6
6
- byzyk
7
7
---
8
8
9
+ ` object ` ` function (percentage: number, message: string, ...args: string[]) `
10
+
9
11
The ` ProgressPlugin ` provides a way to customize how progress is reported during a compilation.
10
12
11
13
## Usage
12
14
13
- Create an instance of ` ProgressPlugin ` with a handler function which will be called when hooks report progress:
15
+ Create an instance of ` ProgressPlugin ` and provide one of the allowed params.
16
+
17
+ ### Providing ` function `
18
+
19
+ Provide a handler function which will be called when hooks report progress. ` handler ` function arguments:
20
+
21
+ - ` percentage ` : a number between 0 and 1 indicating the completion percentage of the compilation
22
+ - ` message ` : a short description of the currently-executing hook
23
+ - ` ...args ` : zero or more additional strings describing the current progress
24
+
14
25
15
26
``` js
16
27
const handler = (percentage , message , ... args ) => {
@@ -21,10 +32,30 @@ const handler = (percentage, message, ...args) => {
21
32
new webpack.ProgressPlugin (handler);
22
33
```
23
34
24
- - ` handler ` is a function which takes these arguments:
25
- - ` percentage ` : a number between 0 and 1 indicating the completion percentage of the compilation.
26
- - ` message ` : a short description of the currently-executing hook.
27
- - ` ...args ` : zero or more additional strings describing the current progress.
35
+ ### Providing ` object `
36
+
37
+ When providing an ` object ` to the ` ProgressPlugin ` , following properties are supported:
38
+
39
+ - ` activeModules: boolean = true ` show's active modules count and one active module in progress message
40
+ - ` entries: boolean = false ` show's entries count in progress message
41
+ - [ ` handler: function(percentage, message, ...args) ` ] ( #providing-function )
42
+ - ` modules: boolean = true ` show's modules count in progress message
43
+ - ` modulesCount: number = 500 ` a minimum modules count to start with. Takes effect when ` modules ` property is enabled.
44
+ - ` profile: true | false | null = false ` tells ` ProgressPlugin ` to collect profile data for progress steps.
45
+
46
+
47
+ ``` js
48
+ new webpack.ProgressPlugin ({
49
+ entries: true ,
50
+ modules: true ,
51
+ modulesCount: 100 ,
52
+ profile: true ,
53
+ handler : (percentage , message , ... args ) => {
54
+ // custom logic
55
+ }
56
+ });
57
+ ```
58
+
28
59
29
60
## Supported Hooks
30
61
0 commit comments