We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a85aab commit 691429fCopy full SHA for 691429f
1 file changed
tests/test-gzip.js
@@ -0,0 +1,25 @@
1
+import fs from 'node:fs';
2
+import zlib from 'node:zlib';
3
+
4
+const files = ['./dist/index.js', './src/index.d.ts'];
5
6
7
+let totalBytes = 0;
8
9
+files.forEach(file => {
10
+ if (fs.existsSync(file)) {
11
+ const content = fs.readFileSync(file);
12
+ const gzipped = zlib.gzipSync(content);
13
+ const bytes = gzipped.length;
14
+ const kb = (bytes / 1024).toFixed(2);
15
16
+ totalBytes += bytes;
17
+ console.log(`${file}: ${bytes} bytes (${kb} KB)`);
18
+ } else {
19
+ console.log(`${file}: Not found!`);
20
+ }
21
+});
22
23
+const totalKb = (totalBytes / 1024).toFixed(2);
24
25
+console.log(`TOTAL BUNDLE SIZE: ${totalBytes} bytes (${totalKb} KB)`);
0 commit comments