UNPKG

1.47 kBMarkdownView Raw
1# rollup-plugin-size-snapshot [![Build Status][travis-img]][travis]
2
3[travis-img]: https://travis-ci.org/TrySound/rollup-plugin-size-snapshot.svg
4[travis]: https://travis-ci.org/TrySound/rollup-plugin-size-snapshot
5
6This plugins allows to track sizes of
7
8* actual bundle size
9* minified with uglify size
10* minified and gzipped size
11
12For `es` format it also produces sizes of treeshaked bundle by importing nothing
13
14```js
15import {} from "bundle";
16```
17
18There are two treeshake points
19
20* webpack in production mode
21* rollup + uglify with enabled toplevel option
22
23## Usage
24
25```js
26import { sizeSnapshot } from "rollup-plugin-size-snapshot";
27
28export default {
29 input: "src/index.js",
30 output: {
31 file: "dist/index.js",
32 format: "es"
33 },
34 plugins: [sizeSnapshot()]
35};
36```
37
38If you use uglify plugin then make sure it is placed after this one
39
40```js
41import uglify from "rollup-plugin-uglify";
42import { sizeSnapshot } from "rollup-plugin-size-snapshot";
43
44export default {
45 // ...
46 plugins: [sizeSnapshot(), uglify({ toplevel: true })]
47};
48```
49
50## Options
51
52### snapshotPath
53
54type: `string`
55default: `'.size-snapshot.json'`
56
57### matchSnapshot
58
59If this value is `true` new snapshot is compared with existing one and is not written to the disk. Usefull to check contributors on CI.
60
61type: `boolean`
62default: `false`
63
64### printInfo
65
66Allows to disable log to terminal.
67
68type: `boolean`
69default: `true`
70
71# License
72
73MIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)