new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · all subjects

environment & configuration

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Environment variable inlining configuration in bunfig.toml

Configure environment variable inlining in the [serve.static] section of bunfig.toml with the env option. Set env = "PUBLIC_*" to only inline env vars starting with PUBLIC_ (recommended), env = "inline" to inline all environment variables, or env = "disable" to disable env var replacement (default). Bun only replaces literal process.env.FOO references, not import.meta.env or indirect access.

Disable HMR in Bun.serve

To disable HMR in `Bun.serve`, set the development option to `{ hmr: false }`.

Environment variable inlining in dev server

Configure environment variable inlining in bunfig.toml under [serve.static] with the env option. Use env = "PUBLIC_*" to only inline env vars starting with PUBLIC_ (recommended), env = "inline" to inline all environment variables, or env = "disable" to disable env var replacement (default). Then run the dev server: `PUBLIC_API_URL=https://api.example.com bun ./index.html`.

Environment variable inlining for production build

When building for production with bun build, use the --env flag to inline environment variables. CLI examples: `bun build ./index.html --outdir=dist --env=inline` to inline all variables, or `bun build ./index.html --outdir=dist --env=PUBLIC_*` to only inline vars with a specific prefix (recommended). In the API, use env: "inline" or env: "PUBLIC_*" option in Bun.build().

Environment variable inlining limitations

Inlining only works with literal `process.env.FOO` references, not `import.meta.env` or indirect access like `const env = process.env; env.FOO`. If an environment variable is not set, you may see runtime errors like `ReferenceError: process is not defined` in the browser.

Give your agent this brain