interface

CompileBuildOptions

interface CompileBuildOptions

  • assets?: string[]

    Files or directories to embed into the executable under their original relative paths. At runtime they are reachable via node:fs and Bun.file() relative to import.meta.dir.

    Equivalent CLI flag: --asset (repeatable)

  • autoloadBunfig?: boolean

    Whether the standalone executable loads bunfig.toml when it runs

    Equivalent CLI flags: --compile-autoload-bunfig, --no-compile-autoload-bunfig

  • autoloadDotenv?: boolean

    Whether the standalone executable loads .env files when it runs

    Equivalent CLI flags: --compile-autoload-dotenv, --no-compile-autoload-dotenv

  • autoloadPackageJson?: boolean

    Whether the standalone executable loads package.json when it runs

    Equivalent CLI flags: --compile-autoload-package-json, --no-compile-autoload-package-json

  • autoloadTsconfig?: boolean

    Whether the standalone executable loads tsconfig.json when it runs

    Equivalent CLI flags: --compile-autoload-tsconfig, --no-compile-autoload-tsconfig

  • bytecodeOrder?: null | string | false | string[]

    Profile-guided layout for the executable's bytecode. Requires bytecode: true.

    Run an executable built with bytecode: true with BUN_BYTECODE_ORDER_OUT=<path> to record which functions it uses, then build again with that file. Bun places the bytecode the run used together at the front, so the executable starts faster and uses less memory. A profile from an older build of the app still applies.

    With several files, list the most common way of starting the app first. false and null mean no profile, so bytecodeOrder: haveProfile && path works.

    Equivalent CLI flag: --bytecode-order <file>[,<file>...]

  • execArgv?: string[]
  • jitPolicy?: number

    The JIT policy the executable starts with (see Bun.unsafe.setJITPolicy). 1 is the normal policy. A value > 1 multiplies JavaScriptCore's tier-up thresholds so code that only runs during startup stays in the interpreter longer; the app should call Bun.unsafe.setJITPolicy(1) once it is interactive.

    Equivalent CLI flag: --compile-jit-policy <n>

  • outfile?: string
  • windows?: { copyright: string; description: string; hideConsole: boolean; icon: string; publisher: string; title: string; version: string }