env

Penv
Bun

Symbol

BuildConfig.env

env?: 'inline' | 'disable' | `${string}*`

Controls how environment variables are handled during bundling.

Can be one of:

  • "inline": Injects environment variables into the bundled output by converting process.env.FOO references to string literals containing the actual environment variable values
  • "disable": Disables environment variable injection entirely
  • A string ending in *: Inlines environment variables that match the given prefix. For example, "MY_PUBLIC_*" will only include env vars starting with "MY_PUBLIC_"
Bun.build({
  env: "MY_PUBLIC_*",
  entrypoints: ["src/index.ts"],
})