|
4 | 4 |
|
5 | 5 | [](https://npmjs.org/package/rollup-plugin-analyzer) [](https://travis-ci.com/doesdev/rollup-plugin-analyzer) [](https://github.com/doesdev/rollup-plugin-analyzer/network/dependents) [](https://npmcharts.com/compare/rollup-plugin-analyzer?minimal=true&interval=7) |
6 | 6 |
|
7 | | -## rollup-plugin-analyzer |
8 | | - |
9 | | -See what's bloating your bundle, how treeshaking has treated you, and other |
10 | | -great stuff. Perfect for console printing an analysis of your bundle or |
11 | | -integrating in your CI workflows. |
| 7 | +## TOC |
| 8 | + |
| 9 | +- [Install](#install) |
| 10 | +- [Usage](#usage) |
| 11 | + + [Importing or Requiring](#importing-or-requiring) |
| 12 | + - [Import as ES Module](#import-as-es-module) |
| 13 | + - [Requiring as CJS](#requiring-as-cjs) |
| 14 | + + [Usage from rollup config](#usage-from-rollup-config) |
| 15 | + + [Usage from build script](#usage-from-build-script) |
| 16 | + + [CI usage example](#ci-usage-example) |
| 17 | + + [Example results](#results) |
| 18 | + + [Example results (with `summaryOnly` enabled)](#results--with--summaryonly--enabled-) |
| 19 | +- [Options](#options) |
| 20 | +- [FAQ](#faq) |
| 21 | +- [License](#license) |
12 | 22 |
|
13 | 23 | ## Install |
14 | 24 |
|
@@ -148,7 +158,7 @@ module count: 5 |
148 | 158 | - **filterSummary** - *optional* |
149 | 159 | - type: Boolean |
150 | 160 | - default: `false` |
151 | | - - description: If `true` the `filter` option will also remove any filtered out module data from the summary |
| 161 | + - description: If `true` the `filter` and `limit` options will also remove any filtered out module data from the summary |
152 | 162 | - **root** - *optional* |
153 | 163 | - type: String |
154 | 164 | - default: `process.cwd()` |
@@ -205,11 +215,19 @@ module count: 5 |
205 | 215 | - **renderedExports** *(Array)* - list of used named exports |
206 | 216 | - **removedExports** *(Array)* - list of unused named exports |
207 | 217 |
|
208 | | -## Other considerations |
| 218 | +## FAQ |
| 219 | + |
| 220 | +#### Why is the reported size not the same as the file on disk? |
| 221 | + |
| 222 | +This module is geared towards the details of the individual modules that make up the bundle and their relative impact to bundle size. That's a detailed way of saying, it doesn't really care about size on disk. There are other options which focus on size on disk as well as delivery size which can be used alongside this module (or in place of if your concern is not per module impact). In particular [rollup-plugin-size-snapshot](https://github.com/TrySound/rollup-plugin-size-snapshot) seems like a great option for that. |
| 223 | + |
| 224 | +Getting a bit further into the details, rather than just intent, of why the reported size differs from that on disk. We get the module data from Rollup which reports it after chunk (module) resolution and tree-shaking, but before post-processing (such as minification and compression). We then add the sizes of each of those modules together, this is the `bundle size` that we report. |
| 225 | + |
| 226 | +That means it won't account for post-processing from other plugins and also won't account for post-processing by Rollup itself, which includes boilerplate / shims depending on what the output format is (CJS, ESM, iife, etc...). |
| 227 | + |
| 228 | +#### Why am I seeing multiple analysis outputs emitted? |
209 | 229 |
|
210 | | -Rollup allows you to output to multiple files. If you are outputting to multiple |
211 | | -files you will get a distinct analysis for each output file. Each analysis |
212 | | -will contain data on the files imported by the respective target. |
| 230 | +Rollup allows you to output to multiple files. If you are outputting to multiple files you will get a distinct analysis for each output file. Each analysis will contain data on the files imported by the respective target. |
213 | 231 |
|
214 | 232 | ## License |
215 | 233 |
|
|
0 commit comments