You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR patches dotenv-expand@13.0.0 with pnpm patch to avoid cloning the full processEnv object for every .env key during expansion.
The patch keeps the same expansion behavior by resolving values lazily with processEnv taking priority over runningParsed, while preserving the existing dependency path instead of forking the package inside Rsbuild.
Comparing upstream dotenv-expand@13.0.0 with the patched package using a large-project-like setup: 2,000 processEnv keys and 200 parsed .env keys.
The PR patches dotenv-expand@13.0.0 to replace the spread-based { ...runningParsed, ...processEnv } construction inside expandValue() with a lazy getEnvValue() helper. This helper checks whether a key is an enumerable own property of processEnv before falling back to runningParsed, avoiding a full object clone on every expansion. The patch is registered in pnpm-workspace.yaml. A new e2e test case is added under e2e/cases/javascript-api/load-env-expand with .env, .env.production, and src/index.js fixture files, plus an index.test.ts that validates loadEnv correctly expands PUBLIC_* variables when a custom processEnv is supplied and that cleanup() removes the composed variable.
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Title check
✅ Passed
The title accurately describes the main change: patching dotenv-expand to improve performance, which is the core objective of the pull request.
Description check
✅ Passed
The pull request description clearly explains the performance optimization for dotenv-expand, including benchmarks and the rationale for using pnpm patch.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Summary
This PR patches
dotenv-expand@13.0.0withpnpm patchto avoid cloning the fullprocessEnvobject for every.envkey during expansion.The patch keeps the same expansion behavior by resolving values lazily with
processEnvtaking priority overrunningParsed, while preserving the existing dependency path instead of forking the package inside Rsbuild.Comparing upstream
dotenv-expand@13.0.0with the patched package using a large-project-like setup: 2,000processEnvkeys and 200 parsed.envkeys.Average speedup: ~513x.
Related