Add support for loading multiple .env files sequentially#20
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
- Add `absolutePaths` and `relativePaths` array options to `ConfigurationOptions` - Add `resolveOptionsFilepaths` function that returns an array of resolved paths - Export `resolveOptionsFilepaths` from the package index - Update `configure` to iterate all resolved paths, merging env vars (later files override earlier) - Add `multi-first.env` and `multi-second.env` test fixtures - Add unit tests for `resolveOptionsFilepaths` and integration tests for multi-env loading in `configure`
Copilot
AI
changed the title
[WIP] Add support for loading multiple .env files
Add support for loading multiple .env files sequentially
May 31, 2026
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.
Users could only specify a single
.envfile path. This adds support for arrays of paths loaded in order, with later files overriding keys from earlier ones while preserving unique keys from all files.Changes
ConfigurationOptions— newabsolutePaths?: string[]andrelativePaths?: string[]options alongside the existing single-path optionsresolveOptionsFilepaths— new function (exported from index) that expands all path options (single + array) into an orderedPathLike[]configure— iterates all resolved paths, merging parsed key-values viaObject.assignso later files win on conflictsUsage