# rollup-plugin-filesize

> A rollup plugin to show filesize in the cli

Latest version **10.0.0** (published 2023-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install rollup-plugin-filesize
pnpm add rollup-plugin-filesize
yarn add rollup-plugin-filesize
bun add rollup-plugin-filesize
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 10.0.0 |
| Published | 2023-02-27 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 8 |
| Unpacked size | 35.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 128 |
| Author | Ritesh Kumar |
| Maintainers | ritz078 |
| Keywords | rollup-plugin |

## Links

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

## Dependencies (8)

- [boxen](https://npm.io/package/boxen.md) ^5.0.0
- [colors](https://npm.io/package/colors.md) 1.4.0
- [pacote](https://npm.io/package/pacote.md) ^15.1.1
- [terser](https://npm.io/package/terser.md) ^5.6.0
- [filesize](https://npm.io/package/filesize.md) ^6.1.0
- [gzip-size](https://npm.io/package/gzip-size.md) ^6.0.0
- [brotli-size](https://npm.io/package/brotli-size.md) 4.0.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.13.8

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 10.0.0 (latest) — 2023-02-27
- 8.0.0-1 (beta) — 2020-04-29
- 9.1.2 — 2022-01-10
- 9.1.1 — 2021-02-27
- 9.1.0 — 2020-12-04
- 9.0.2 — 2020-06-30
- 9.0.1 — 2020-06-14
- 9.0.0 — 2020-05-12
- 8.0.2 — 2020-05-02
- 8.0.1 — 2020-05-02
- 8.0.0 — 2020-04-30
- 8.0.0-0 — 2020-04-29
- 7.0.0 — 2020-04-06
- 6.2.1 — 2019-10-15
- 6.2.0 — 2019-08-09
- … 30 more at https://npm.io/package/rollup-plugin-filesize/versions

## README

# rollup-plugin-filesize

> A rollup plugin to show filesize in the cli

![](screen.png)

## Installation

```
npm install rollup-plugin-filesize
```

## Usage

```js
import { rollup } from 'rollup';
import filesize from 'rollup-plugin-filesize';

rollup({
  entry: 'main.js',
  plugins: [
    filesize()
  ]
}).then(...)
```

## options

#### showMinifiedSize

type: `boolean`
default: true

Whether to show minified size or not

#### showGzippedSize

type: `boolean`
default: true

Whether to show Gzipped size or not

#### showBrotliSize

type: `boolean`
default: false

Whether to show [Brotli](https://www.wikiwand.com/en/Brotli) size or not

#### showBeforeSizes

**Note: this feature is experimental and may be changed in a future release.**

type: `"release"`, `"build"`, or `"none"`
default: `"none"`

Indicates how, if any, comparisons will be shown between the
`output.file` file size as it was and as it is now being written.

If set to `"release"`, will compare the file size at present to that of
the last npm release.

If set to `"build"`, the size of the file that is now being built will
be compared to the immediately previous build. This means that if you run
Rollup multiple times with this option, the info on the previous package
size will be lost (since Rollup will have overwritten your copy), so with
this option, you will need to consult your terminal history to see what the
file size was prior to your changes. This option may be useful if you wish
to compare size changes incrementally as you are developing rather than
comparing to your last release.

#### format

type : `object`

default : {}

See the options [here](https://github.com/avoidwork/filesize.js#optional-settings)

#### reporter

(Note that this replaces the deprecated optional `render` function option.)

type : A reporter string (currently "boxen" only), a function, or an array thereof.

Defaults to "boxen".

After rendering occurs, you may wish to pass on the collected file data,
e.g., to build a badge for filesizes (as does [filesize-badger](https://github.com/brettz9/filesize-badger)).

You can use `reporter` to do so:

```js
filesize({
	reporter: [
		function (options, bundle, {
			minSize, gzipSize, brotliSize, bundleSize,
			fileName,
			// "showBeforeSizes: release"
			lastVersion,
			// "showBeforeSizes: "release" or "showBeforeSizes": "build"
			bundleSizeBefore, brotliSizeBefore, minSizeBefore, gzipSizeBefore
		}) {
			// If a promise is returned, it will be awaited before rendering.
			return promise;
		},
	],
});
```

#### theme

type: `string`

default : 'dark'

options : 'dark'/'light'

choose based on your terminal theme.

## License

MIT

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