网页 综合 更新时间 2026-11-14 16:20:49

Stats Data | webpack

自动蜘蛛 webpack.js.org 正文约 2588 字
Stats Data | webpack
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:
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 containing module-specific compilation stats.
The top-level structure of the output JSON file is fairly straightforward but there are a few nested data structures as well. Each nested structure has a dedicated section below to make this document more consumable. Note that you can click links within the top-level structure below to jump to relevant sections and documentation:
Each assets object represents an output file emitted from the compilation. They all follow a similar structure:
Each chunks object represents a group of modules known as a chunk. Each object follows the following structure:
The chunks object will also contain a list of origins describing how the given chunk originated. Each origins object follows the following schema:
What good would these statistics be without some description of the compiled application's actual modules? Each module in the dependency graph is represented by the following structure:
Every module also contains a list of reasons objects describing why that module was included in the dependency graph. Each "reason" is similar to the origins seen above in the chunk objects section:
The errors and warnings properties each contain a list of objects. Each object contains a message, a stack trace and various other properties:
Note that the stack traces are removed when errorStack: false is passed to the toJson method. The errorStack option is set to true by default.
Copyright OpenJS Foundation and webpack contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy
访问原文 返回搜索 https://webpack.js.org/api/stats/
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。