From 7bce76ddbc52151452c0bbc59b5d809850ed024c Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 10 Aug 2022 21:50:41 +0200 Subject: [PATCH] fix: include all files for total size report --- src/build.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/build.ts b/src/build.ts index 5cfa010..e436b13 100644 --- a/src/build.ts +++ b/src/build.ts @@ -195,10 +195,8 @@ export async function build (rootDir: string, stub: boolean, inputConfig: BuildC } } - let distSize = 0 const rPath = (p: string) => relative(process.cwd(), resolve(options.outDir, p)) for (const entry of ctx.buildEntries.filter(e => !e.chunk)) { - distSize += entry.bytes || 0 let totalBytes = entry.bytes || 0 for (const chunk of entry.chunks || []) { totalBytes += ctx.buildEntries.find(e => e.path === chunk)?.bytes || 0 @@ -216,7 +214,7 @@ export async function build (rootDir: string, stub: boolean, inputConfig: BuildC } consola.log(entry.chunk ? chalk.gray(line) : line) } - console.log('Σ Total dist size:', chalk.cyan(prettyBytes(distSize))) + console.log('Σ Total dist size (byte size):', chalk.cyan(prettyBytes(ctx.buildEntries.reduce((a, e) => a + (e.bytes || 0), 0)))) // Validate validateDependencies(ctx)