Skip to content

IOEXT-2184: fix: set Parcel mode from NODE_ENV instead of always using development (CEXT-6815) - #248

Merged
sandeep-paliwal merged 2 commits into
adobe:masterfrom
iivvaannxx:proper-build-mode-node-env
Oct 8, 2026
Merged

sandeep-paliwal merged 2 commits into
adobe:masterfrom
iivvaannxx:proper-build-mode-node-env

Conversation

@iivvaannxx

@iivvaannxx iivvaannxx commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Parcel defaults mode to development when it isn't passed in, so bundle and buildWeb always produced development builds, even with NODE_ENV=production.

bundle and buildWeb now set mode from NODE_ENV, using production only when NODE_ENV=production. They pass env.NODE_ENV to Parcel. When the caller doesn't set shouldOptimize, it defaults to true in production. Callers can still override mode, env and defaultTargetOptions explicitly.

The e2e script regex now also matches unquoted src attributes, which appear once Parcel minifies the HTML in production.

Related Issue

IOEXT-2184 (blocks CEXT-6815)

Companion PR adobe/aio-cli-plugin-app#942 reloads .env after pre-app hooks, so a NODE_ENV set there reaches this build.

Motivation and Context

Production deploys shipped development bundles with dev-only code paths and no minification.

How Has This Been Tested?

  • npm test: 135 tests pass, including new tests for production mode from NODE_ENV and for explicit overrides.
  • eslint src test e2e is clean.

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 added tests to cover my changes.
  • All new and existing tests passed.

@codecov

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@iivvaannxx iivvaannxx changed the title fix: set Parcel mode from NODE_ENV instead of always using development (CEXT-6815) IOEXT-2184: fix: set Parcel mode from NODE_ENV instead of always using development (CEXT-6815) Sep 29, 2026
Comment thread e2e/e2e.js
Comment thread src/build-web.js Outdated
@sandeep-paliwal

Copy link
Copy Markdown
Contributor

Thanks @iivvaannxx . Code changes look good.
Can you also share e2e test screenshots where it captures CLI behavior with and without the use of this production mode?

@iivvaannxx

Copy link
Copy Markdown
Contributor Author

@sandeep-paliwal I recorded a video better :)

The problem that this caused to us is that when Parcel was building a development build but we forced it to select the React production version via NODE_ENV we got an issue with hot-reloading on aio app run, and the UI didn't render at all. In the below video you'll see how this fixes it:

  1. I show the issue (UI doesn't render and there's a "React Refresh ..." error message)
  2. I link my local version of the aio app plugin, which contains this patched version of aio-lib-web
  3. I build again and start the UI again and everything works.
Screen.Recording.2026-10-05.at.18.09.57.mov

@sandeep-paliwal sandeep-paliwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@santosh-chamoli santosh-chamoli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iivvaannxx

Copy link
Copy Markdown
Contributor Author

@sandeep-paliwal @santosh-chamoli please merge when you can, I don't have permissions to do it :(

@sandeep-paliwal
sandeep-paliwal merged commit 72b1d4c into adobe:master Oct 8, 2026
10 checks passed
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.

3 participants