build: compile CLI binary with NODE_ENV=production#416
Merged
Conversation
bun build --compile produced binaries running with process.env.NODE_ENV === "development", so React loaded its development build and emitted dev-only warnings to end users (e.g. "Cannot update a component while rendering a different component" during playground deploy). Add --define process.env.NODE_ENV='"production"' to every bun build --compile invocation (package.json build/cli:install and the three release workflows) so React ships in production mode: the warning machinery is stripped and React is faster and smaller.
Contributor
|
Dev build ready — try this branch: |
Contributor
E2E Test Pass · ❌ FAILTag:
Sentry traces: view spans for this run |
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
bun build --compileproduces binaries that run withprocess.env.NODE_ENV === "development"by default (verified live on Bun 1.3.13 — the compiled binary reportsdevelopmentat runtime, and the build script carried no override). As a result React loaded its development build and emitted dev-only warnings to end users duringplayground deploy, e.g.:Investigation
The warning is purely cosmetic and independent of any deploy failure (in the reported cases the real failure was the CDM package-ownership preflight). I drove the real
DeployScreenthrough the exact failing path — realRunningStage, real adapters,setStage("error")+app.unmount()in the same async tick — in a dev-mode React environment and got zero warnings, confirming there is no render-phasesetStatebug in our code to fix. The warning is an artifact of shipping React's dev build in the SEA binary, so the correct, mechanism-independent fix is to ship React in production mode.Fix
Add
--define process.env.NODE_ENV='"production"'to everybun build --compileinvocation:package.json—buildandcli:install.github/workflows/release.yml,release-contract-manifest.yml,dev-release.yml— all 4 cross-compile targets eachProduction React omits the dev-warning machinery entirely (and is faster/smaller), so the warning cannot fire regardless of the SEA-runtime trigger.
Verification
--version→0.43.4).react-reconciler.production.min;Cannot update a component→ 0 matchesreact-reconciler.development;Cannot update a component→ 1 match--target=bun-linux-x64).NODE_ENVbranches insrc/— forcing production changes only React/Ink internals, not app logic.install.shand the e2e release workflows download the prebuilt release artifacts (now built with the flag); the functional e2e runner usesbun run src/index.ts(interpreted), unaffected.pnpm format:check,pnpm lint:license,pnpm typecheck,pnpm test(1005 passing) all green.Includes a changeset (
playground-cli: patch).