Skip to content

build: compile CLI binary with NODE_ENV=production#416

Merged
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/react-production-build
Jun 17, 2026
Merged

build: compile CLI binary with NODE_ENV=production#416
UtkarshBhardwaj007 merged 1 commit into
mainfrom
fix/react-production-build

Conversation

@UtkarshBhardwaj007

Copy link
Copy Markdown
Member

Problem

bun build --compile produces binaries that run with process.env.NODE_ENV === "development" by default (verified live on Bun 1.3.13 — the compiled binary reports development at runtime, and the build script carried no override). As a result React loaded its development build and emitted dev-only warnings to end users during playground deploy, e.g.:

Warning: Cannot update a component (DeployScreen) while rendering a different component (RunningStage2)…

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 DeployScreen through the exact failing path — real RunningStage, 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-phase setState bug 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 every bun build --compile invocation:

  • package.jsonbuild and cli:install
  • .github/workflows/release.yml, release-contract-manifest.yml, dev-release.yml — all 4 cross-compile targets each

Production React omits the dev-warning machinery entirely (and is faster/smaller), so the warning cannot fire regardless of the SEA-runtime trigger.

Verification

  • Built the binary: runs (--version0.43.4).
  • Grepped prod vs dev binaries — the warning code path is stripped:
    • prod: bundles react-reconciler.production.min; Cannot update a component0 matches
    • dev (no flag): bundles react-reconciler.development; Cannot update a component1 match
  • Same result confirmed for a cross-compiled non-host target (--target=bun-linux-x64).
  • No NODE_ENV branches in src/ — forcing production changes only React/Ink internals, not app logic.
  • install.sh and the e2e release workflows download the prebuilt release artifacts (now built with the flag); the functional e2e runner uses bun 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).

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.
@github-actions

Copy link
Copy Markdown
Contributor

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/fix/react-production-build bash

@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 7cf5610 into main Jun 17, 2026
16 of 20 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the fix/react-production-build branch June 17, 2026 18:45
@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Pass · ❌ FAIL

Tag: e2e-ci-pr · Branch: fix/react-production-build · Commit: a07d553 · Run logs

Cell Result Time
pr-mod ❌ FAIL 5m00s
pr-preflight ❌ FAIL 2m12s
pr-deploy-foundry ✅ PASS 1m07s
pr-login-session ❌ FAIL 6m18s
pr-deploy-cdm ✅ PASS 3m47s
pr-deploy-frontend ❌ FAIL 3m32s
pr-install ✅ PASS 1m29s
${{ matrix.cell }} ⏭️ SKIP 0m-1s
${{ matrix.cell }} ⏭️ SKIP 0m-1s

Sentry traces: view spans for this run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant