You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/api/stats.mdx
+30-21Lines changed: 30 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ contributors:
5
5
- skipjack
6
6
- franjohn21
7
7
- byzyk
8
+
- EugeneHlushko
8
9
---
9
10
10
11
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:
@@ -22,33 +23,33 @@ The top-level structure of the output JSON file is fairly straightforward but th
22
23
23
24
```js-with-links
24
25
{
25
-
"version": "1.4.13", // Version of webpack used for the compilation
26
-
"hash": "11593e3b3ac85436984a", // Compilation specific hash
27
-
"time": 2469, // Compilation time in milliseconds
28
-
"filteredModules": 0, // A count of excluded modules when [`exclude`](/configuration/stats/#stats) is passed to the [`toJson`](/api/node/#statstojsonoptions) method
29
-
"outputPath": "/", // path to webpack output directory
30
-
"assetsByChunkName": {
26
+
'version': '1.4.13', // Version of webpack used for the compilation
27
+
'hash': '11593e3b3ac85436984a', // Compilation specific hash
28
+
'time': 2469, // Compilation time in milliseconds
29
+
'filteredModules': 0, // A count of excluded modules when [`exclude`](/configuration/stats/#stats) is passed to the [`toJson`](/api/node/#statstojsonoptions) method
30
+
'outputPath': '/', // path to webpack output directory
31
+
'assetsByChunkName': {
31
32
// Chunk name to emitted asset(s) mapping
32
-
"main": "web.js?h=11593e3b3ac85436984a",
33
-
"named-chunk": "named-chunk.web.js",
34
-
"other-chunk": [
35
-
"other-chunk.js",
36
-
"other-chunk.css"
33
+
'main': 'web.js?h=11593e3b3ac85436984a',
34
+
'named-chunk': 'named-chunk.web.js',
35
+
'other-chunk': [
36
+
'other-chunk.js',
37
+
'other-chunk.css'
37
38
]
38
39
},
39
-
"assets": [
40
+
'assets': [
40
41
// A list of [asset objects](#asset-objects)
41
42
],
42
-
"chunks": [
43
+
'chunks': [
43
44
// A list of [chunk objects](#chunk-objects)
44
45
],
45
-
"modules": [
46
+
'modules': [
46
47
// A list of [module objects](#module-objects)
47
48
],
48
-
"errors": [
49
+
'errors': [
49
50
// A list of [error strings](#errors-and-warnings)
50
51
],
51
-
"warnings": [
52
+
'warnings': [
52
53
// A list of [warning strings](#errors-and-warnings)
53
54
]
54
55
}
@@ -63,14 +64,22 @@ Each `assets` object represents an `output` file emitted from the compilation. T
63
64
64
65
```js
65
66
{
66
-
"chunkNames": [], // The chunks this asset contains
67
-
"chunks": [ 10, 6 ], // The chunk IDs this asset contains
68
-
"emitted": true, // Indicates whether or not the asset made it to the `output` directory
69
-
"name": "10.web.js", // The `output` filename
70
-
"size": 1058// The size of the file in bytes
67
+
'chunkNames': [], // The chunks this asset contains
68
+
'chunks': [ 10, 6 ], // The chunk IDs this asset contains
69
+
'emitted': true, // Indicates whether or not the asset made it to the `output` directory
70
+
'name': '10.web.js', // The `output` filename
71
+
'size': 1058, // The size of the file in bytes
72
+
'info': {
73
+
'immutable': true, // A flag telling whether the asset can be long term cached (contains a hash)
74
+
'size': 1058, // The size in bytes, only becomes available after asset has been emitted
75
+
'development': true, // A flag telling whether the asset is only used for development and doesn't count towards user-facing assets
76
+
'hotModuleReplacement': true// A flag telling whether the asset ships data for updating an existing application (HMR)
77
+
}
71
78
}
72
79
```
73
80
81
+
T> Asset's `info` property is available since webpack v4.40.0
0 commit comments