Skip to content

Commit 42785c7

Browse files
natemoo-reematipico
authored andcommitted
fix(#6965): fix build stats (#8122)
1 parent 33b8910 commit 42785c7

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.changeset/lovely-walls-call.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Improve fidelity of time stats when running `astro build`

packages/astro/src/core/build/generate.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,17 @@ async function generatePage(
287287
builtPaths
288288
);
289289

290+
let prevTimeEnd = timeStart;
290291
for (let i = 0; i < paths.length; i++) {
291292
const path = paths[i];
292293
await generatePath(path, generationOptions, pipeline);
293294
const timeEnd = performance.now();
294-
const timeChange = getTimeStat(timeStart, timeEnd);
295+
const timeChange = getTimeStat(prevTimeEnd, timeEnd);
295296
const timeIncrease = `(+${timeChange})`;
296297
const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type);
297298
const lineIcon = i === paths.length - 1 ? '└─' : '├─';
298299
logger.info(null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`);
300+
prevTimeEnd = timeEnd;
299301
}
300302
}
301303

0 commit comments

Comments
 (0)