Skip to content

HarshwardhanSingh/webpack-bundle-size-check-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebpackBundleSizeCheckPlugin

Maintainability

Warning: Alpha code, please don't use in production just yet.

Desciption

A simple webpack plugin to keep your build size in check.

Getting Started

Installation

npm i webpack-bundle-size-check-plugin

Configuring

  1. Import in your webpack.config.js file.
  2. Add to your plugins array.
<!-- import on the top of the file -->
const WebpackBundleSizeCheckPlugin = require('webpack-bundle-size-check-plugin');

plugins: [
  new WebpackBundleSizeCheckPlugin([
    {
      chunkName: 'app.bundle.js',  // exact name of output file
      maxSize: '100',              // in KB
      mode: 'strict'               // "non-strict" by default
    }
  ])
]

and that's it.

If you select "strict" mode then the build will fail if the size exceeds the maxSize specified. If you select "non-strict" (default) mode then you will get a warning if the size exceeds the specified limit.

Now if you build size exceeds the allowed size, your build will fail with proper error message like Build Size for app.bundle.js exceeded the permitted size 100KB

About

A Webpack plugin for keeping your bundle size in check

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published