Skip to content

Commit 63cc51c

Browse files
sentienceskipjack
authored andcommitted
docs(api): improve documentation for --profile (#1343)
The sample output that was previously shown for `--profile` will not appear unless `--progress` is also used. This change spells this out, and also describes the per-module timings that `--profile` produces by itself.
1 parent 685ed38 commit 63cc51c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

content/api/cli.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,27 @@ These options allow webpack to display various [stats](/configuration/stats/) an
289289

290290
### Profiling
291291

292-
This option profiles the compilation and includes this information in the stats output. It gives you an in depth idea of which step in the compilation is taking how long. This can help you optimise your build in a more informed manner.
292+
The `--profile` option captures timing information for each step of the compilation and includes this in the output.
293293

294294
```bash
295295
webpack --profile
296296

297+
298+
[0] ./src/index.js 90 bytes {0} [built]
299+
factory:22ms building:16ms = 38ms
300+
```
301+
302+
For each module, the following details are included in the output as applicable:
303+
304+
* `factory`: time to collect module metadata (e.g. resolving the filename)
305+
* `building`: time to build the module (e.g. loaders and parsing)
306+
* `dependencies`: time to identify and connect the module’s dependencies
307+
308+
Paired with `--progress`, `--profile` gives you an in depth idea of which step in the compilation is taking how long. This can help you optimise your build in a more informed manner.
309+
310+
```bash
311+
webpack --progress --profile
312+
297313
30ms building modules
298314
1ms sealing
299315
1ms optimizing
@@ -319,4 +335,5 @@ webpack --profile
319335
26ms chunk asset optimization
320336
1ms asset optimization
321337
6ms emitting
338+
322339
```

0 commit comments

Comments
 (0)