Skip to content

SOLR-18593: Install JS client devDependencies regardless of NODE_ENV - #5248

Merged
epugh merged 3 commits into
apache:mainfrom
epugh:SOLR-18593-js-client-prod-install
Oct 29, 2026
Merged

epugh merged 3 commits into
apache:mainfrom
epugh:SOLR-18593-js-client-prod-install

Conversation

@epugh

@epugh epugh commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • solr/webapp/js-client's jsClientDownloadDeps Gradle task ran plain npm install, which npm treats as --production whenever the caller's environment has NODE_ENV=production set - silently skipping devDependencies.
  • That breaks the build: the package's own prepare lifecycle script (npm run build, i.e. Babel) needs those devDependencies (@babel/core, presets, plugins like @babel/plugin-syntax-dynamic-import) to run.
  • This bit RC3 smoke testing specifically because dev-tools/scripts/smokeTestRelease.py does env.update(os.environ) when shelling out, inheriting whatever ambient NODE_ENV the release manager's shell happened to have set.
  • Fix: args.set(listOf("install", "--include=dev")). This workspace is purely a build-time code generator (Gradle syncs the OpenAPI-generated sources in, Babel transpiles, browserify bundles the result into one file for the webapp) - none of its node_modules/package.json are ever published, so there's no actual "production" artifact here to keep lean by omitting dev tooling. Installing dev deps unconditionally makes the build correct independent of the caller's ambient environment.

Verification

  • Reproduced the failure standalone: copied the generated workspace to a scratch dir, ran NODE_ENV=production npm install - fails with ERR_MODULE_NOT_FOUND on @babel/plugin-syntax-dynamic-import during the prepare script's Babel build, confirming the root cause.
  • Confirmed NODE_ENV=production npm install --include=dev fixes it in that same scratch dir.
  • Confirmed the real Gradle task, :solr:webapp:js-client:jsClientBuild, succeeds from a clean node_modules both with and without NODE_ENV=production set after this change.

🤖 Generated with Claude Code

solr/webapp/js-client's npm install previously ran as plain `npm install`,
which npm interprets as --production whenever NODE_ENV=production is set in
the caller's environment - skipping devDependencies. That breaks the build,
since the package's own "prepare" script (npm run build, i.e. babel) needs
devDependencies (@babel/core, presets, plugins) to run. This bit RC3 smoke
testing, where smokeTestRelease.py's subprocess inherited the release
manager's ambient NODE_ENV=production.

This workspace is purely a build-time code generator (Gradle syncs the
OpenAPI-generated sources in, babel transpiles them, browserify bundles the
result into one file for the webapp) - none of its node_modules/package.json
get published, so there's no "production" artifact here to keep lean by
omitting dev tooling. --include=dev makes the install correct regardless of
the caller's ambient environment.

Verified empirically: reproduced the failure in a scratch copy of the
generated workspace with NODE_ENV=production npm install (ERR_MODULE_NOT_FOUND
on @babel/plugin-syntax-dynamic-import), confirmed --include=dev fixes it
there, and confirmed the Gradle jsClientBuild task succeeds both with and
without NODE_ENV=production set after this change.
The generated JS client's build (solr/webapp/js-client) now installs with --include=dev, so it no
longer fails when the builder's environment has NODE_ENV=production set - npm would otherwise
skip the devDependencies (Babel and its plugins) that the build's own "prepare" script needs.
type: fixed

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.

Maybe user "other" for non-product fixes?

@janhoy janhoy 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, one nit with changelog type

@epugh

epugh commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

I was struggling with "is this worth it", but going to take your vote as a +1... will make change.

@epugh

epugh commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @nick-boss-tech for putting this change together!

@epugh epugh added this to the 10.x milestone Oct 28, 2026
@epugh
epugh merged commit 3db7100 into apache:main Oct 29, 2026
4 checks passed
dsmiley pushed a commit that referenced this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants