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