# size-plugin

> Tracks your Webpack asset sizes over time.

Latest version **3.0.0** (published 2021-01-29) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install size-plugin
pnpm add size-plugin
yarn add size-plugin
bun add size-plugin
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-01-29 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 385.9 KB |
| Known vulnerabilities | 0 (+24 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1661 |
| Author | Jason Miller |
| Maintainers | developit |
| Keywords | webpack plugin, file size, gzip size, bundle size |

## Links

- npm: https://www.npmjs.com/package/size-plugin
- Repository: https://github.com/googlechromelabs/size-plugin
- Homepage: https://github.com/googlechromelabs/size-plugin#readme
- Issues: https://github.com/googlechromelabs/size-plugin/issues
- npm.io page: https://npm.io/package/size-plugin

## Dependencies (8)

- [glob](https://npm.io/package/glob.md) ^7.1.4
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [ci-env](https://npm.io/package/ci-env.md) ^1.9.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^5.3.0
- [util.promisify](https://npm.io/package/util.promisify.md) ^1.0.0
- [escape-string-regexp](https://npm.io/package/escape-string-regexp.md) ^1.0.5

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2021-01-29
- 2.0.2 — 2021-01-29
- 2.0.1 — 2019-10-18
- 2.0.0 — 2019-08-22
- 1.2.0 — 2019-03-20
- 1.1.4 — 2019-03-15
- 1.1.3 — 2019-03-15
- 1.1.2 — 2019-02-06
- 1.1.1 — 2018-12-11
- 1.1.0 — 2018-12-06
- 1.0.1 — 2018-08-27
- 1.0.0 — 2018-08-24
- 0.0.1 — 2018-08-23

## README

<p align="center">
  <h1 align="center">
    size-plugin
    <a href="https://www.npmjs.org/package/size-plugin"><img src="https://img.shields.io/npm/v/size-plugin.svg?style=flat" alt="npm"></a>
  </h1>
</p>

<p align="center">
  Prints the gzipped sizes of your webpack assets and the changes since the last build.
</p>

<p align="center">
  <img src="https://i.imgur.com/3bWBrJm.png" width="602" alt="size-plugin">
</p>

> 🙋 Using Rollup? Check out the [rollup-plugin-size](https://github.com/luwes/rollup-plugin-size) port.

## Installation

Install `size-plugin` as a development dependency using npm:

```sh
npm i -D size-plugin
```

* * *

## Usage

Add an instance of the plugin to your webpack configuration:

```diff
// webpack.config.js
+ const SizePlugin = require('size-plugin');

module.exports = {
  plugins: [
+    new SizePlugin()
  ]
}
```

* * *

## Options

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [SizePlugin](#sizeplugin)
    -   [Parameters](#parameters)
-   [Item](#item)
    -   [Properties](#properties)
-   [Data](#data)
    -   [Properties](#properties-1)

### SizePlugin

`new SizePlugin(options)`

#### Parameters

-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
    -   `options.pattern` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** minimatch pattern of files to track
    -   `options.exclude` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** minimatch pattern of files NOT to track
    -   `options.filename` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** file name to save filesizes to disk
    -   `options.publish` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** option to publish filesizes to size-plugin-store
    -   `options.writeFile` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** option to save filesizes to disk
    -   `options.stripHash` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** custom function to remove/normalize hashed filenames for comparison

### Item

#### Properties

-   `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Filename of the item
-   `sizeBefore` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Previous size, in kilobytes
-   `size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Current size, in kilobytes
-   `sizeText` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Formatted current size
-   `delta` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Difference from previous size, in kilobytes
-   `deltaText` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Formatted size delta
-   `msg` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Full item's default message
-   `color` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The item's default CLI color

### Data

#### Properties

-   `sizes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Item](#item)>** List of file size items
-   `output` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Current buffered output

## License

[Apache 2.0](LICENSE)

This is not an official Google product.

---
_Source: https://npm.io/package/size-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
