Skip to content

CEXT-6573: ship production React build for Admin UI SDK apps (gate StrictMode to development) - #635

Merged
iivvaannxx merged 7 commits into
releasefrom
CEXT-6573/strict-mode-production-build
Aug 19, 2026
Merged

CEXT-6573: ship production React build for Admin UI SDK apps (gate StrictMode to development)#635
iivvaannxx merged 7 commits into
releasefrom
CEXT-6573/strict-mode-production-build

Conversation

@iivvaannxx

Copy link
Copy Markdown
Collaborator

Description

aio app build never sets Parcel's mode or NODE_ENV, so Admin UI SDK apps ship React's development build to production: <StrictMode> double-invokes renders/effects and the bundle is ~18% larger and slower. This is an interim, SDK-side fix (works on all current aio CLI versions) made of two coordinated changes:

  • @adobe/aio-commerce-lib-app now sets NODE_ENV in the app .env via its build hooks so the web bundler produces the matching React build:
    • pre-app-build (backend-ui/2) writes NODE_ENV=production.
    • New pre-app-dev / pre-app-run hooks reset NODE_ENV=development, so aio app dev / aio app run keep serving the development build (no stale value leaks between commands — verified, since dev/run run a single extension and never re-run pre-app-build).
    • Adds a setNodeEnv helper to the internal scripting-utils.
  • @adobe/aio-commerce-lib-admin-ui gates <StrictMode> on process.env.NODE_ENV !== "production", so the wrapper is dead-code-eliminated from production bundles (and retained in development).

The cleaner long-term fix lives upstream in the aio build pipeline (aio-lib-web / aio-cli-plugin-app passing Parcel mode: 'production' for builds and 'development' for dev/run), which would set NODE_ENV and activate export conditions natively. That only helps after a new aio CLI ships, so it is out of scope here.

Related Issue

  • CEXT-6573 (this change)
  • Relates to CEXT-6540

Motivation and Context

Automated systems that build and deploy apps run aio app build without --web-optimize and without setting NODE_ENV, so the deployed browser bundle uses React's development build. That causes StrictMode's double-invocation in production and a materially larger/slower bundle. Making production builds set NODE_ENV=production fixes both at once (production React build + StrictMode inert), and the admin-ui gate additionally strips the <StrictMode> wrapper from production output.

How Has This Been Tested?

  • End-to-end Parcel bundle (driven with the same options aio-lib-web uses: mode development, shouldOptimize: false), against a copy of a real Admin UI SDK app:
    • No NODE_ENV (plain aio app build) → bundle ships React's dev build and keeps <StrictMode>.
    • .env NODE_ENV=production → bundle ships React's production build (Minified React error present, dev-only strings gone) and the <StrictMode> wrapper is dead-code-eliminated.
  • Hook write/reset cycle via the app's bin/cli.mjs: pre-app-build writes NODE_ENV=production; pre-app-dev / pre-app-run flip it back to development in place (no stale leak).
  • Unit tests added for setNodeEnv; pnpm typecheck clean across all packages; scripting-utils (148), aio-commerce-lib-app (1022) and aio-commerce-lib-admin-ui (212) test suites pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have read the DEVELOPMENT document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 56fbe57

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@adobe/aio-commerce-lib-admin-ui Patch
@adobe/aio-commerce-lib-auth Patch
@adobe/aio-commerce-lib-app Patch
@aio-commerce-sdk/scripting-utils Patch
@adobe/aio-commerce-plugin-app-management Patch
@adobe/aio-commerce-sdk Patch
@adobe/aio-commerce-lib-api Patch
@adobe/aio-commerce-lib-config Patch
@adobe/aio-commerce-lib-events Patch
@adobe/aio-commerce-lib-webhooks Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added with-changeset The PR contains a Changeset file. pkg: aio-commerce-lib-app Includes changes in `packages/aio-commerce-lib-app` private-pkg: scripting-utils Includes changes to `packages-private/scripting-utils` pkg: aio-commerce-lib-admin-ui labels Aug 17, 2026
Comment thread packages/aio-commerce-lib-app/source/commands/hooks/pre-app-build.ts Outdated
@iivvaannxx
iivvaannxx merged commit 71bf666 into release Aug 19, 2026
6 of 7 checks passed
@iivvaannxx
iivvaannxx deleted the CEXT-6573/strict-mode-production-build branch August 19, 2026 11:27
@github-actions github-actions Bot mentioned this pull request Aug 19, 2026
@iivvaannxx

Copy link
Copy Markdown
Collaborator Author

/snapshot

@github-actions

Copy link
Copy Markdown
Contributor

📦 Alpha packages published

Package Version
@adobe/aio-commerce-lib-admin-ui 1.0.1-alpha-20260819113253
@adobe/aio-commerce-lib-auth 1.1.3-alpha-20260819113253
@adobe/aio-commerce-lib-app 1.10.1-alpha-20260819113253
@adobe/aio-commerce-sdk 1.4.2-alpha-20260819113253
@adobe/aio-commerce-lib-api 1.3.1-alpha-20260819113253
@adobe/aio-commerce-lib-config 1.6.1-alpha-20260819113253
@adobe/aio-commerce-lib-events 1.3.1-alpha-20260819113253
@adobe/aio-commerce-lib-webhooks 1.2.1-alpha-20260819113253

Install:

npm install @adobe/aio-commerce-lib-admin-ui@1.0.1-alpha-20260819113253
npm install @adobe/aio-commerce-lib-auth@1.1.3-alpha-20260819113253
npm install @adobe/aio-commerce-lib-app@1.10.1-alpha-20260819113253
npm install @adobe/aio-commerce-sdk@1.4.2-alpha-20260819113253
npm install @adobe/aio-commerce-lib-api@1.3.1-alpha-20260819113253
npm install @adobe/aio-commerce-lib-config@1.6.1-alpha-20260819113253
npm install @adobe/aio-commerce-lib-events@1.3.1-alpha-20260819113253
npm install @adobe/aio-commerce-lib-webhooks@1.2.1-alpha-20260819113253

You can also install by just specifying the tag:

npm install @adobe/aio-commerce-sdk@alpha

But note that the tag will always point to the latest alpha snapshot, so it may not be the same version as listed above.

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

Labels

pkg: aio-commerce-lib-admin-ui pkg: aio-commerce-lib-app Includes changes in `packages/aio-commerce-lib-app` plugin: aio-commerce-plugin-app-management private-pkg: scripting-utils Includes changes to `packages-private/scripting-utils` with-changeset The PR contains a Changeset file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants