Created
September 3, 2020 05:28
-
-
Save GitaiQAQ/d7d06ae80567f9b051b260b6ea2d8319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import byteSize from 'byte-size'; | |
| const manifest = []; | |
| process.on('beforeExit', () => { | |
| console.table(manifest); | |
| }); | |
| export default () => ({ | |
| name: 'Size', | |
| generateBundle(_, bundles) { | |
| Object.entries(bundles).forEach(([key, bundle]) => { | |
| if (bundle.code) { | |
| manifest.push([key, '' + byteSize(bundle.code.length, { | |
| units: 'iec', | |
| })]); | |
| } else if (bundle.source) { | |
| manifest.push([key, '' + byteSize(bundle.source.length, { | |
| units: 'iec', | |
| })]); | |
| } | |
| }); | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment