Skip to content

Commit

Permalink
fix: include all files for total size report
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 10, 2022
1 parent 16d851b commit 7bce76d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/build.ts
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 7bce76d

Please sign in to comment.