Skip to content

pradeepkumargit/angular8-webpack-bundle-analyzer

Repository files navigation

Angular8 Webpack Bundle Analyzer

Webpack Bundle Analyzer

Visualize size of webpack output files with an interactive zoomable treemap.

Why to use Webpack Bundle Analyzer in Angular 7/8 Application

This module will help you:

  1. Realize what is really inside your bundle
  2. Find out what modules make up the most of its size
  3. Find modules that got there by mistake
  4. Optimize it!

And the best thing is it supports minified bundles! It parses them to get real size of bundled modules. And it also shows their gzipped sizes!

What is Webpack Bundle Analyzer

Visualize size of webpack output files with an interactive zoomable treemap.

How to Install

# NPM
npm install --save-dev webpack-bundle-analyzer
npm install --save-dev webpack-cli

How to Use it

  1. run ng serve
  2. ng build --statsJson=true
  3. Add webpack-bundle-analyzer in script object in your angular 7/8 application package.json file
"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "analyze":"webpack-bundle-analyzer dist/angular8-webpack-bundle-analyzer/stats-es2015.json"
  }
  1. npm run analyze
  2. This command will open a new browser window at port(http://127.0.0.1:8888/), open this in Chrome browser for better view , and then you see your application budle utilization.

It will create an interactive treemap visualization of the contents of all your bundles.

webpack bundle analyzer zoomable treemap

My local Angular 8 App Screenshot

This project was generated with Angular CLI version 8.3.3.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

About

Webpack plugin that we can install in your Angular 8 application and CLI utility that represents bundle content as convenient interactive zoomable treemap

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published