mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +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:
@@ -296,7 +296,9 @@ pub const StandaloneModuleGraph = struct {
|
||||
pub const Flags = packed struct(u32) {
|
||||
disable_default_env_files: bool = false,
|
||||
disable_autoload_bunfig: bool = false,
|
||||
_padding: u30 = 0,
|
||||
disable_autoload_tsconfig: bool = false,
|
||||
disable_autoload_package_json: bool = false,
|
||||
_padding: u28 = 0,
|
||||
};
|
||||
|
||||
const trailer = "\n---- Bun! ----\n";
|
||||
|
||||
Reference in New Issue
Block a user