Skip to content

Commit 5708e15

Browse files
Stabilize dev single-build error paths
Guard stats access and reject when finishOutput fails in the dev single-build path. Prevents silent hangs and ensures CI/dev runs surface errors promptly
1 parent 243c2a9 commit 5708e15

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

build.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,17 @@ async function build() {
562562

563563
await new Promise((resolve, reject) =>
564564
runWebpack(false, false, false, outdir, async (err, stats) => {
565-
if (err || stats.hasErrors()) {
565+
if (err || (stats && typeof stats.hasErrors === 'function' && stats.hasErrors())) {
566566
console.error(err || stats.toString())
567567
reject(err || new Error('webpack error'))
568568
return
569569
}
570-
await finishOutput('')
571-
resolve()
570+
try {
571+
await finishOutput('')
572+
resolve()
573+
} catch (e) {
574+
reject(e)
575+
}
572576
}),
573577
)
574578
}

0 commit comments

Comments
 (0)