Files
vue-tui/packages
Yunfei He 41cd720f93 fix(cli): guard request-reload handler against extractBundle rejection (#175)
The vue-tui:request-reload hot handler awaited extractBundle with no
try/catch. extractBundle throws ("No JS bundle found in Vite memoryFiles")
on a transient/broken build, and Vite's hot event emitter does not catch
async handler rejections — so the rejection escaped as an unhandledRejection
that could take down the whole dev process. The crash-respawn interval right
below already guards extractBundle for the same reason.

Extract the reload logic into a testable, module-scoped handleReloadRequest()
(also folding in the acceptReloads startup guard via a shouldAccept predicate)
and wrap the extract/restart work in try/catch: on failure, log via
logger.error and KEEP the previous bundle (no setBundlePath/restart), so a
momentarily broken build no longer kills the dev server. The inline
server.hot.on handler now delegates to it.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 20:47:33 +08:00
..