Skip to content

Commit 64e4231

Browse files
snitin315chenxsan
andauthored
docs(api): update stats data (#4225)
* docs(api): update stats data * apply suggestions from code review Co-authored-by: Sam Chen <chenxsan@gmail.com> * Update src/content/api/stats.mdx Co-authored-by: Sam Chen <chenxsan@gmail.com> Co-authored-by: Sam Chen <chenxsan@gmail.com>
1 parent d416b85 commit 64e4231

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

src/content/api/stats.mdx

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ contributors:
99
- superburrito
1010
- chenxsan
1111
- rahul3v
12+
- snitin315
1213
---
1314

1415
When compiling source code with webpack, users can generate a JSON file containing statistics about modules. These statistics can be used to analyze an application's dependency graph as well as to optimize compilation speed. The file is typically generated with the following CLI command:
1516

1617
``` bash
17-
webpack --profile --json > compilation-stats.json
18+
npx webpack --profile --json=compilation-stats.json
1819
```
1920

20-
The `--json > compilation-stats.json` flag indicates to webpack that it should emit the `compilation-stats.json` containing the dependency graph and various other build information. Typically, the `--profile` flag is also added so that a `profile` section is added to each [`modules` object](#module-objects) containing module-specific compilation stats.
21+
The `--json=compilation-stats.json` flag indicates to webpack that it should emit the `compilation-stats.json` containing the dependency graph and various other build information. Typically, the `--profile` flag is also added so that a `profile` section is added to each [`modules` object](#module-objects) containing module-specific compilation stats.
2122

2223

2324
## Structure
@@ -26,10 +27,10 @@ The top-level structure of the output JSON file is fairly straightforward but th
2627

2728
``` js-with-links
2829
{
29-
'version': '5.0.0-alpha.6', // Version of webpack used for the compilation
30+
'version': '5.9.0', // Version of webpack used for the compilation
3031
'hash': '11593e3b3ac85436984a', // Compilation specific hash
3132
'time': 2469, // Compilation time in milliseconds
32-
'filteredModules': 0, // A count of excluded modules when [`exclude`](/configuration/stats/#statsexclude) is passed to the [`toJson`](/api/node/#statstojsonoptions) method
33+
'publicPath': 'auto',
3334
'outputPath': '/', // path to webpack output directory
3435
'assetsByChunkName': {
3536
// Chunk name to emitted asset(s) mapping
@@ -53,12 +54,17 @@ The top-level structure of the output JSON file is fairly straightforward but th
5354
'modules': [
5455
// A list of [module objects](#module-objects)
5556
],
57+
'entryPoints': {
58+
// A list of [entry objects](#entry-objects)
59+
},
5660
'errors': [
5761
// A list of [error objects](#errors-and-warnings)
5862
],
63+
'errorsCount': 0, // number of errors
5964
'warnings': [
6065
// A list of [warning objects](#errors-and-warnings)
61-
]
66+
],
67+
'warningsCount': 0, // nummber of warnings
6268
}
6369
```
6470

@@ -187,6 +193,30 @@ Every module also contains a list of `reasons` objects describing why that modul
187193
}
188194
```
189195

196+
### Entry Objects
197+
198+
```json
199+
"main": {
200+
"name": "main",
201+
"chunks": [
202+
179
203+
],
204+
"assets": [
205+
{
206+
"name": "main.js",
207+
"size": 22
208+
}
209+
],
210+
"filteredAssets": 0,
211+
"assetsSize": 22,
212+
"auxiliaryAssets": [],
213+
"filteredAuxiliaryAssets": 0,
214+
"auxiliaryAssetsSize": 0,
215+
"children": {},
216+
"childAssets": {},
217+
"isOverSizeLimit": false
218+
}
219+
```
190220

191221
### Errors and Warnings
192222

0 commit comments

Comments
 (0)