fix(tui): use default import for signal-exit (not named export) - #42429
Closed
chronikion wants to merge 1 commit into
Closed
fix(tui): use default import for signal-exit (not named export)#42429chronikion wants to merge 1 commit into
chronikion wants to merge 1 commit into
Conversation
signal-exit exports as a default export, not a named export. The
named import { onExit } crashes at runtime in the prebuilt bundle on
environments where npm is broken and the fallback path is taken.
Discovered after the npm-install-fallback fix (2a9f0ca): the prebuilt
bundle launched successfully, then immediately crashed because the
bundled import style was wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes:
Fix
ui-tui/packages/hermes-ink/src/ink/ink.tsx: use default import forsignal-exit.Why would it change:
signal-exitis a CJS module exported as a single function viamodule.exports.The current prebuilt
dist/entry.jsaccesses the module correctly via.defaultat three callsites (lines 43321, 53327, 54299). But the TypeScript source uses a named import{ onExit }which would resolve toundefinedon the next esbuild rebuild, breaking the TUI on any environment — not just the npm-broken one.Discovered during a separate debugging effort (PR #40694). Confirmed by the actual runtime error:
TypeError: (0, import_signal_exit.onExit) is not a function.How to verify:
The fix has no behavioral change — it corrects the import to match the module's actual export shape. The esbuild
__toESMwrapper sets.defaulttomodule.exports, soimport onExit from 'signal-exit'resolves correctly.Tests:
Build-time correctness fix — the module's export shape doesn't change at runtime. The existing prebuilt bundle already uses
.defaultaccess and works. The fix prevents a regression on the next rebuild.Platforms tested:
Related: