Feature Request: Analyze gzipped bundles #584
Replies: 12 comments
-
Thank you for opening this separate issue, it is now much clearer what is being asked! If we'd want to support this, it might be enough to spot that file ends in webpack-bundle-analyzer/src/parseUtils.js Lines 10 to 11 in b618f65 to decompress the |
Beta Was this translation helpful? Give feedback.
-
@valscion, I'd like to help but I'm not sure if my local fork is setup right because nothing I change(console logs, file writes) seem to reflect in the webpack build. Steps:
|
Beta Was this translation helpful? Give feedback.
-
Hmm, I'm hazy on how |
Beta Was this translation helpful? Give feedback.
-
I played around with this and was able to get content from the compressed file by doing:
Config which I kept was:
However, there is still a blank page for the above config. Reason being that when stats.toJSON() call tries to map chunks at stats/DefaultStatsFactoryPlugin.js#L260, it sees that But, there is a way to fix this by keeping output filename and compressed filename same, like:
This way webpack can map the chunks to compressed file and so can BundlerAnalyzer. And all stats are generated correctly. @valscion let me know if it makes sense, I can raise a PR for this. PS: There is an issue logged for this in compression-plugin webpack-contrib/compression-webpack-plugin#49 |
Beta Was this translation helpful? Give feedback.
-
@xitter, great stuff! were you able to test it out with Brotli compression as well or that would be a different feature request? |
Beta Was this translation helpful? Give feedback.
-
Brotli is a different feature request :) |
Beta Was this translation helpful? Give feedback.
-
Sorry, don't have time to reply thoroughly to your comment yet, @xitter — sounds like you have made some progress and a PR could be useful |
Beta Was this translation helpful? Give feedback.
-
@RedVelocity @valscion Brotli also worked well as zlib supports it, PR on the way. Config for brotli:
|
Beta Was this translation helpful? Give feedback.
-
Made a PR(#379), please have a look. |
Beta Was this translation helpful? Give feedback.
-
Was there ever a resolution to this? I'm currently in a situation where we use |
Beta Was this translation helpful? Give feedback.
-
Looks like #379 PR is open but the review by @th0r seems to be incomplete |
Beta Was this translation helpful? Give feedback.
-
For the time being I've just had to run a separate build and pass in a "isStatsBuild" parameter to webpack to omit the compression. It works - not ideal, though. |
Beta Was this translation helpful? Give feedback.
-
Issue description
webpack-bundle-analyzer currently displays a blank page when a webpack build uses compression-webpack-plugin to compress bundles.
Technical info
Using the following workaround. This skips compression when webpack build command is used with 'analyze' environment variable.
Debug info
How do you use this module? As CLI utility or as plugin?
-Both
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 })
)new BundleAnalyzerPlugin()
What other Webpack plugins were used?
clean-webpack-plugin: ^3.0.0 => 3.0.0
compression-webpack-plugin: ^4.0.1 => 4.0.1
html-webpack-plugin: ^4.3.0 => 4.3.0
optimize-css-assets-webpack-plugin: ^5.0.3 => 5.0.3
webpack: ^4.44.1 => 4.44.1
webpack-bundle-analyzer: ^3.8.0 => 3.8.0
webpack-cli: ^3.3.12 => 3.3.12
webpack-dev-server: ^3.11.0 => 3.11.0
webpack-merge: ^5.1.1 => 5.1.1
Beta Was this translation helpful? Give feedback.
All reactions