How to find out which files are included in the webpack assembly

Is there a way to see which files are included in the webpack assembly and, preferably, their size? The reason I want this is to get an idea of ​​my builds, and to keep an eye out for accidentally including files that shouldn't be there.

+7
reactjs webpack
source share
1 answer

By default, the CLI webpack will print the path of all included modules and their corresponding size.

Webpack can also generate a stats.json file for you, which contains information about each module included in your assembly.

In the CLI:

 webpack --json > stats.json 

From the NodeJS API:

 webpack(config, function(err, stats) { fs.writeFileSync('./stats.json', JSON.stringify(stats.toJson())); }); 

Then you can either write your own statistics analyzer tool, or use existing tools such as a great web page statistics analyzer .

+15
source share

All Articles