You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Jarred Sumner <[email protected]>
clap.parseParam("--no-compile-autoload-dotenv Disable autoloading of .env files in standalone executable") catchunreachable,
154
154
clap.parseParam("--compile-autoload-bunfig Enable autoloading of bunfig.toml in standalone executable (default: true)") catchunreachable,
155
155
clap.parseParam("--no-compile-autoload-bunfig Disable autoloading of bunfig.toml in standalone executable") catchunreachable,
156
+
clap.parseParam("--compile-autoload-tsconfig Enable autoloading of tsconfig.json at runtime in standalone executable (default: false)") catchunreachable,
157
+
clap.parseParam("--no-compile-autoload-tsconfig Disable autoloading of tsconfig.json at runtime in standalone executable") catchunreachable,
158
+
clap.parseParam("--compile-autoload-package-json Enable autoloading of package.json at runtime in standalone executable (default: false)") catchunreachable,
159
+
clap.parseParam("--no-compile-autoload-package-json Disable autoloading of package.json at runtime in standalone executable") catchunreachable,
156
160
clap.parseParam("--bytecode Use a bytecode cache") catchunreachable,
157
161
clap.parseParam("--watch Automatically restart the process on file change") catchunreachable,
158
162
clap.parseParam("--no-clear-screen Disable clearing the terminal screen on reload when --watch is enabled") catchunreachable,
0 commit comments