webpack-bundle-size-check-plugin

0.1.6 • Public • Published

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

Package Sidebar

Install

npm i webpack-bundle-size-check-plugin

Weekly Downloads

6

Version

0.1.6

License

MIT

Last publish

Collaborators

  • harshwardhan94