fix: load hidden environment files on Windows#201
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows-specific regression in envied_generator where hidden environment files (e.g. .env and .env/.env.dev) fail to resolve under build_runner AOT by switching resolution from Isolate.resolvePackageUri to .dart_tool/package_config.json via package_config. It also strengthens end-to-end coverage and adds a Windows CI job to prevent regressions.
Changes:
- Resolve hidden env file paths via
findPackageConfig(Directory.current)+ package root lookup instead ofIsolate.resolvePackageUri. - Expand the build_runner regression test to cover both
.envand.env/.env.dev. - Add a Windows GitHub Actions job to run the hidden-env build_runner test and gate publish dry runs on it.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/envied_generator/lib/src/load_envs.dart | Switches hidden-path filesystem fallback from Isolate.resolvePackageUri to package_config-based resolution. |
| packages/envied_generator/pubspec.yaml | Adds package_config dependency needed for package-root resolution. |
| packages/envied_generator/test/hidden_directory_build_runner_test.dart | Extends the e2e build_runner fixture test to validate both .env and hidden-directory env paths. |
| .github/workflows/test.yml | Adds a Windows CI job to run the hidden env-file regression test and makes publish dry-runs depend on it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
petercinibulk
approved these changes
Jul 2, 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.
Summary
Isolate.resolvePackageUri..envand.env/.env.dev.Problem
The filesystem fallback added in #198 restored hidden environment-file support on Linux and macOS, but still failed under build-runner’s AOT process on Windows.
Although the files existed,
Isolate.resolvePackageUricould not resolve the consumer package root. Envied consequently reported:Pinning
envied_generatorto 1.3.5 avoided the regression because that version read relative paths directly from the filesystem.Solution
Use
findPackageConfig(Directory.current)to load.dart_tool/package_config.json, locate the package identified byAssetId.package, and resolve the environment path against its declared package root.This approach:
package_config2.2.x.Testing
.env.env/.env.devwindows-latestCI job.envied_generatortests pass locally.Fixes #200.