mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
fix: set proper env_behavior defaults for different commands
- Build command uses .disable as default (env vars handled via define mechanism) - Run/Test/other commands use .load_all_without_inlining as default - This ensures .env files are loaded by default for run command while bundler tests still pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -414,7 +414,7 @@ pub const Command = struct {
|
||||
|
||||
production: bool = false,
|
||||
|
||||
env_behavior: api.DotEnvBehavior = .load_all_without_inlining,
|
||||
env_behavior: api.DotEnvBehavior = .disable,
|
||||
env_prefix: []const u8 = "",
|
||||
elide_lines: ?usize = null,
|
||||
// Compile options
|
||||
@@ -433,6 +433,13 @@ pub const Command = struct {
|
||||
.allocator = allocator,
|
||||
};
|
||||
global_cli_ctx = &context_data;
|
||||
|
||||
// Set appropriate default env_behavior based on command
|
||||
// Build command uses .disable as default (env vars handled via define mechanism)
|
||||
// Run/Test/other commands use .load_all_without_inlining as default
|
||||
if (comptime command != .BuildCommand) {
|
||||
global_cli_ctx.bundler_options.env_behavior = .load_all_without_inlining;
|
||||
}
|
||||
|
||||
if (comptime Command.Tag.uses_global_options.get(command)) {
|
||||
global_cli_ctx.args = try Arguments.parse(allocator, global_cli_ctx, command);
|
||||
|
||||
Reference in New Issue
Block a user