mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
feat(compile): add --compile-autoload-tsconfig and --compile-autoload-package-json flags (#25340)
## Summary By default, standalone executables no longer load `tsconfig.json` and `package.json` at runtime. This improves startup performance and prevents unexpected behavior from config files in the runtime environment. - Added `--compile-autoload-tsconfig` / `--no-compile-autoload-tsconfig` CLI flags (default: false) - Added `--compile-autoload-package-json` / `--no-compile-autoload-package-json` CLI flags (default: false) - Added `autoloadTsconfig` and `autoloadPackageJson` options to the `Bun.build()` compile config - Flags are stored in `StandaloneModuleGraph.Flags` and applied at runtime boot This follows the same pattern as the existing `--compile-autoload-dotenv` and `--compile-autoload-bunfig` flags. ## Test plan - [x] Added tests in `test/bundler/bundler_compile_autoload.test.ts` - [x] Verified standalone executables work correctly with runtime config files that differ from compile-time configs - [x] Verified the new CLI flags are properly parsed and applied - [x] Verified the JS API options work correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
@@ -443,6 +443,8 @@ pub const BuildCommand = struct {
|
||||
.{
|
||||
.disable_default_env_files = !ctx.bundler_options.compile_autoload_dotenv,
|
||||
.disable_autoload_bunfig = !ctx.bundler_options.compile_autoload_bunfig,
|
||||
.disable_autoload_tsconfig = !ctx.bundler_options.compile_autoload_tsconfig,
|
||||
.disable_autoload_package_json = !ctx.bundler_options.compile_autoload_package_json,
|
||||
},
|
||||
) catch |err| {
|
||||
Output.printErrorln("failed to create executable: {s}", .{@errorName(err)});
|
||||
|
||||
Reference in New Issue
Block a user