Repository navigation
fix: keep runnerImport from setting NODE_ENV (fix #20299) - #24202
Closed
Israel-Kli wants to merge 1 commit into
Closed
Israel-Kli wants to merge 1 commit into
Israel-Kli wants to merge 1 commit into
Conversation
Contributor
|
This PR has been automatically flagged as likely to be created by a bot, LLM, or agent, and will be automatically closed. These contributions harm the maintenance of the project. Please read our AI policy for more information. If you believe this is a mistake, please reply to this comment and we will review it. |
Author
|
There's a person behind this PR, and I'm responsible for it. I used Claude Code to write the change and its tests, as the description says, and I'll follow up on review comments. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
runnerImportcallsresolveConfigwith theservecommand, which defaults an unsetprocess.env.NODE_ENVtodevelopment. That default stays on the process after the import, so a laterbuild()can run as development. This fixes #20299 by savingNODE_ENVbeforeresolveConfigand restoring it afterwards when it was unset or empty and is still the default. A value set by a config hook is left alone.Alternative considered: changing
resolveConfigitself. That would also changecreateServerandbuild, where the default is intended (#18712), so the fix stays inrunnerImport.For reviewers: with
NODE_ENVunset, the imported module now evaluates without it instead of withdevelopment; the CLI path is unaffected because its outer config resolution sets the value first. A concurrentbuild()duringrunnerImportcan still see the default.AI disclosure: I used Claude Code to write the change and the tests. I reviewed the diff, ran the unit tests (8 passed), lint and format locally, and confirmed the new tests fail without the source change and when an assertion is altered. Full suites and typecheck are left to CI.