docs(tui): clarify why @hermes/ink is aliased to source in build.mjs

Update the comment on the `alias` entry to mention the second reason
the source-inline is needed: keeping the upstream `ink` /
`ink-text-input` graph out of the bundle (which fixed the startup
deadlock in #31227). Code path is unchanged.
This commit is contained in:
xxxigm 2026-05-24 08:45:30 +07:00 committed by Teknium
parent 18297899d7
commit 53d2c4191f

View file

@ -35,9 +35,14 @@ await build({
outfile: out,
jsx: 'automatic',
jsxImportSource: 'react',
// Skip the prebuilt @hermes/ink bundle — esbuild's __esm helper doesn't
// await nested async init, which breaks lazy-initialized exports like
// `render`. Bundling from source sidesteps that.
// Skip the prebuilt @hermes/ink bundle and inline the source instead:
// (1) esbuild's `__esm` helper does not await nested async init, so the
// prebuilt bundle's lazy `render` would never resolve when nested in
// this top-level Promise.all; (2) bundling from source also lets us
// keep `ink-text-input` and the upstream `ink` graph OUT of the
// bundle entirely — re-exporting them from entry-exports created a
// circular async chain that hung the TUI at startup with only ANSI
// reset bytes on screen (#31227).
alias: { '@hermes/ink': resolve(root, 'packages/hermes-ink/src/entry-exports.ts') },
plugins: [stubDevtools],
// Some transitive deps use CommonJS `require(...)` at runtime. ESM bundles