Closed oprav closed 3 years ago
The main.js
appears to be a concatenated module in your screenshot so we do not have any size information to show how its contents are split.
Are you able to see the parsed size of the main.js
file, though?
This module concatenation is the result of webpack 5 enabling module concatenation by default. See:
Thanks for a quick reply.
Are you able to see the parsed size of the main.js file, though?
No, main.js
doesn't report parsed size:
main.js + 2 modules
does show it although its value appears to be the size of entire bundle (including node_modules
):
I tried disasbling concatenateModules
behaviour, but it doesn't seem to have any effect.
main.js + 2 modules
does show it although its value appears to be the size of entire bundle (includingnode_modules
):
Yes so it works as expected :) there's nothing we can do about this as the bundle no longer contains module boundaries
So in case module boundaries are not erased (i.e. concatenateModules: false
) - parsed sizes should be calculated?
In case they should - it doesn't happen in the repro setup linked in the issue description.
If the visualizer shows the (concatenated)
text, it means that webpack has concatenated the modules for some reason. Further analysis on why that happens is outside the scope of webpack-bundle-analyzer
☺️
Issue description
While migrating from
webpack@3 + webpack-bundle-analyzer@3
towebpack@5.51.1 + webpack-bundle-analyzer@4.4.2
I noticed that HTML report doesn't seem to displayparsed
sizes of bundled modules anymore. It also looks like bundlednode_modules
's stats are not displayed when switching intoparsed
treemap view.Notes: This might be related to https://github.com/webpack-contrib/webpack-bundle-analyzer/issues/327 although I'm not totally sure since #327 mentions issues for edge cases only.
I have created a minimal repro setup demonstrating allegedly missing stats: https://github.com/oprav/wba-webpack5-repro
Not sure if this is expected - I noticed that this condition doesn't seem to be met when attempting to generate report for my bundle: https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/f83c46a1159ad96cd8ad02562766ed9807ceb205/src/parseUtils.js#L43
i.e. there are no modules parsed into
walk.locations
: https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/f83c46a1159ad96cd8ad02562766ed9807ceb205/src/parseUtils.js#L145Technical info
Debug info
How do you use this module? As CLI utility or as plugin?
Plugin
If CLI, what command was used? (e.g.
webpack-bundle-analyzer -O path/to/stats.json
)If plugin, what options were provided? (e.g.
new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true })
)What other Webpack plugins were used?
None
(for repro code)It would be nice to also attach webpack stats file. It can be generated using these options:
stats.json
will be created in Webpack bundle output directory.File link: https://github.com/oprav/wba-webpack5-repro/blob/master/output/stats.json