Electrify is an Electrode Javascript bundle viewer.
Electrify is a stunning visual tool for analyzing the module tree of electrode-io + webpack project bundles. It's especially handy for catching large and/or duplicate modules which might be either bloating your bundle or slowing down the build process.
Electrify lives on npm, so if you haven't already, make sure you have node installed on your machine first.
You can easily install Electrify by issuing the following sudo command.
$ sudo npm install -g electrode-electrify
Module: electrode-electrify
$ npm install --save electrode-electrify
electrify [stats-bundle(s)...] {options}
Options:
-h, --help Displays these instructions.
-O, --open Opens viewer in a new browser window automatically
-m, --mode the default file scale mode to display: should be
either "count" or "size". Default: size
When you install Electrify globally, the electrify
command-line tool is available and can be used to quickly check out your bundle. As of [email protected]
, the tool takes any webpack-stats object example as input and creates a standalone HTML page as output.
You can easily chain the stats file into another command, or use the --open
flag to open Electrify in your browser automatically. For example:
$ electrify build/stats.json --open
You can switch between multiple color palettes, most of which serve to highlight specific features of your bundle.
Structure highlights show node_modules
directories as green andlib
directories as orange. This makes it easy to scan for "kitchen sink" modules or modules with lots of dependencies.
File type highlights show each file type (e.g..js
,.css
, etc.) in a different color. This is helpful for identifying code generated from a transform that's bloating your bundle more than expected.
The original or pastel highlights simply provide a means for easier reading and viewing on screen.
The following resources and tools can be used.
- disc-browserify (Helpful for analyzing **browserify **projects and a huge inspiration for electrify, used disc extensively in my past **browserify **based projects)
- webpack-bundle-size-analyzer
- webpack-visualizer
- webpack-chart
- stats-webpack-plugin