fix(tui): pin the automatic JSX runtime in the build config - #1272
Draft
posthog[bot] wants to merge 1 commit into
Draft
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Nothing under src/ imports React, so a classic-runtime transform emits unbound `React.*` references. tsdown had no JSX option and relied on tsconfig discovery. Pin `inputOptions.transform.jsx` to the automatic runtime, add a postbuild smoke check that the pin reaches every chunk, and turn the two module-scope subtitle fragments into components. Generated-By: PostHog Desktop Task-Id: 8fb56a6d-32ed-43b5-aa88-871a9f25117a
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a Context Mill branch:
Add Results will be posted here when complete. |
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.
Problem
ReferenceError: React is not definedand shows no TUI at all. The throw is unhandled (onuncaughtexception), so the process is gone before the first frame.src/importsReact. The whole TUI depends on the automatic JSX runtime to injectjsxandFragment.tsdown.config.tsset no JSX option and relied on tsconfig discovery.vitest.config.tsalready had to pinesbuild: { jsx: 'automatic' }, which shows the toolchain does not give this for free.main, so this points at a branch build. The same gap would break every run if it shipped.Changes
tsdown.config.tsnow setsinputOptions.transform.jsxexplicitly, so the built output no longer depends on which tsconfig rolldown finds.Important
The object form is required. The documented string form
jsx: 'react-jsx'is accepted by the TypeScript types but silently ignored at the napi boundary, and the tsconfig value still wins. I verified both forms against a tsconfig set to"jsx": "react":transform.jsxvaluereact'react-jsx'(string){ runtime: 'automatic' }dist/*.jschunk carriesReact.createElementorReact.Fragment. Without it, a future option-shape change would regress the same way, silently.DEFAULT_SUBTITLE, and the screen-localSUBTITLE), so they build their JSX at render time rather than at import time.Note
The component conversion is a local improvement, not the fix. About ten content-deck modules under
src/lib/programs/*/content/still hold module-scope arrays of JSX elements, and reshaping that deck API is out of scope here. The build pin plus the smoke check is what actually closes the startup-crash class.Test plan
Reproduced the exact reported failure, then confirmed the fix removes it
Forcing a classic-runtime build reproduces the reported error verbatim:
With the pin restored,
node --input-type=module -e "import './dist/bin.js'"loads and prints the banner, and the smoke test passes. The new smoke check also fires on a deliberately classic build, so it is not a no-op.IntroScreenLayoutthroughink-testing-libraryand confirmed the default subtitle still draws both lines.pnpm exec vitest run— 2837 tests across 177 files pass.pnpm build(which runs the smoke test as a postbuild hook) passes.pnpm typecheckreports pre-existing errors onmainin files this PR does not touch; none in the changed files.Created with PostHog Desktop from this inbox report.