Repository navigation
Add .env file support, and import.meta.env replacement - #1
Merged
FlorianRappl merged 2 commits intoJul 25, 2026
Merged
Conversation
Deferred in favor of future --preset + --define config system. Keeps .env loading, import.meta.env, --define, --alias, --loader support. EnvLoader now loads .env and .env.local (no mode-specific files). All 427 tests pass.
mehrabix
force-pushed
the
add-mode-and-env-support
branch
from
July 25, 2026 07:35
def21c8 to
c36e023
Compare
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.
Types of Changes
Prerequisites
Please make sure you can check the following two boxes:
Contribution Type
What types of changes does your code introduce? Put an
xin all the boxes that apply:Description
Adds developer experience features inspired by Vite:
Features
.envfile support - Loads env variables from.envand.env.local(VITE_ prefix filtered by default)import.meta.env.Xreplacement - Replaces env references in JS/TS with loaded values--defineflag - Replace global identifiers with constant expressions (e.g.--define process.env.NODE_ENV="production")--aliasflag - Rewrite import specifiers (e.g.--alias react=preact/compat)--loaderflag - Override file extension handling (e.g.--loader .svg=text)Usage
Files Changed
src/NetPack.Core/Graph/EnvLoader.cs- New .env file parsersrc/NetPack.Core/Graph/BundlerContext.cs- Added EnvVars propertysrc/NetPack.Core/Graph/Traverse.cs- Env variable supportsrc/NetPack.Cli/Commands/BundleCommand.cs- .env loading + define/alias/loader flagssrc/NetPack.Tests/CliOptionsTests.cs- Tests for define, alias, loader, import.meta.envsrc/NetPack.Tests/EnvLoaderTests.cs- New test file for EnvLoaderTests
All 427 tests passing.