webpack-visualizer icon indicating copy to clipboard operation
webpack-visualizer copied to clipboard

how about a CLI version

Open mikeerickson opened this issue 8 years ago • 3 comments

Something like

$ visualize stats.json

which will proceed to build chart and open web page (locally)

mikeerickson avatar Jan 14 '17 01:01 mikeerickson

Can you write a bit more about the use case for this?

If you're using the plugin you should be able to open dist/stats.html

chrisbateman avatar Jan 18 '17 02:01 chrisbateman

I am not using the plugin version, but will give it a whirl.

mikeerickson avatar Jan 18 '17 03:01 mikeerickson

The idea would be to do the same thing as https://github.com/th0r/webpack-bundle-analyzer. I have an "analyse" npm script that output a lot of information about the bundle size and chunk. I look like that:

webpack --config build/webpack.prod.conf.js --json --profile --progress > stats.json && webpack-bundle-analyzer stats.json --mode static --report report.html

That create a report.html and open it automatically. I also don't have to modify the config files and script to get that. I only feed webpack-bundle-analyzer the stats.json and it output everything relative my project folder, not the output of the bundle. Since your plugin seem to feed from the same file (stats.json), it would be fantastic to be able to do the same thing:

webpack --config build/webpack.prod.conf.js --json --profile --progress > test/analyze/stats.json && webpack-visualizer-plugin stats.json --output output.html

I have no idea how hard this is, and I have zero knowledge about webpack plugins but maybe the sources of https://github.com/th0r/webpack-bundle-analyzer could help ? Anyway, thank you for your work on this really nice visualizer. I has already helped me reduce the size of my bundles and efficiently detect the major problems at a glance 👍

lionel-bijaoui avatar Feb 27 '17 09:02 lionel-bijaoui