From 5ec48f3d4b4e22e00bb341c581da400e9ddd9403 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Sat, 6 Sep 2025 02:02:07 +0000 Subject: [PATCH] fix: set proper env_behavior defaults for different commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/cli.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cli.zig b/src/cli.zig index 078db88bc4..a156089f4d 100644 --- a/src/cli.zig +++ b/src/cli.zig @@ -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);