diff options
-rw-r--r-- | docs/runtime/configuration.md | 129 |
1 files changed, 59 insertions, 70 deletions
diff --git a/docs/runtime/configuration.md b/docs/runtime/configuration.md index 2ae81713a..21a12d8b2 100644 --- a/docs/runtime/configuration.md +++ b/docs/runtime/configuration.md @@ -12,37 +12,6 @@ You can also create a global configuration file at the following paths: If both a global and local `bunfig` are detected, the results are shallow-merged, with local overridding global. CLI flags will override `bunfig` setting where applicable. -## Environment variables - -These environment variables are checked by Bun to detect functionality and toggle features. - -{% table %} - -- Name -- Description - ---- - -- `TMPDIR` -- Bun occasionally requires a directory to store intermediate assets during bundling or other operations. If unset, defaults to the platform-specific temporary directory: `/tmp` on Linux, `/private/tmp` on macOS. - ---- - -- `NO_COLOR` -- If `NO_COLOR=1`, then ANSI color output is [disabled](https://no-color.org/). - ---- - -- `FORCE_COLOR` -- If `FORCE_COLOR=1`, then ANSI color output is force enabled, even if `NO_COLOR` is set. - ---- - -- `DO_NOT_TRACK` -- If `DO_NOT_TRACK=1`, then analytics are [disabled](https://do-not-track.dev/). Bun records bundle timings (so we can answer with data, "is Bun getting faster?") and feature usage (e.g., "are people actually using macros?"). The request body size is about 60 bytes, so it's not a lot of data. - -{% /table %} - ## Runtime ```toml @@ -56,6 +25,9 @@ jsxFactory = "h" jsxFragment = "Fragment" jsxImportSource = "react" +# Reduce memory usage at the cost of performance +smol = true + # Set a default framework to use # By default, Bun will look for an npm package like `bun-framework-${framework}`, followed by `${framework}` logLevel = "debug" @@ -77,33 +49,15 @@ logLevel = "debug" # It will recognize non-GUI editors, but I don't think it will work yet ``` -### Debugging - -```toml -[debug] -# When navigating to a blob: or src: link, open the file in your editor -# If not, it tries $EDITOR or $VISUAL -# If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others -# This is used by Bun.openInEditor() -editor = "code" - -# List of editors: -# - "subl", "sublime" -# - "vscode", "code" -# - "textmate", "mate" -# - "idea" -# - "webstorm" -# - "nvim", "neovim" -# - "vim","vi" -# - "emacs" -``` - ## Test runner ```toml [test] # setup scripts to run before all test files preload = ["./setup.ts"] + +# Reduce memory usage at the cost of performance +smol = true ``` ## Package manager @@ -210,29 +164,64 @@ save = true print = "yarn" ``` -## Dev server (`bun dev`) +### Debugging + +```toml +[debug] +# When navigating to a blob: or src: link, open the file in your editor +# If not, it tries $EDITOR or $VISUAL +# If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others +# This is used by Bun.openInEditor() +editor = "code" + +# List of editors: +# - "subl", "sublime" +# - "vscode", "code" +# - "textmate", "mate" +# - "idea" +# - "webstorm" +# - "nvim", "neovim" +# - "vim","vi" +# - "emacs" +``` -{% The `bun dev` command is likely to change soon and will likely be deprecated in an upcoming release. We recommend %} +## Environment variables -Here is an example: +These environment variables are checked by Bun to detect functionality and toggle features. -```toml -# Set a default framework to use -# By default, Bun will look for an npm package like `bun-framework-${framework}`, followed by `${framework}` -framework = "next" +{% table %} + +- Name +- Description + +--- + +- `TMPDIR` +- Bun occasionally requires a directory to store intermediate assets during bundling or other operations. If unset, defaults to the platform-specific temporary directory: `/tmp` on Linux, `/private/tmp` on macOS. + +--- + +- `NO_COLOR` +- If `NO_COLOR=1`, then ANSI color output is [disabled](https://no-color.org/). -[bundle] -saveTo = "node_modules.bun" -# Don't need this if `framework` is set, but showing it here as an example anyway -entryPoints = ["./app/index.ts"] +--- -[bundle.packages] -# If you're bundling packages that do not actually live in a `node_modules` folder or do not have the full package name in the file path, you can pass this to bundle them anyway -"@bigapp/design-system" = true +- `FORCE_COLOR` +- If `FORCE_COLOR=1`, then ANSI color output is force enabled, even if `NO_COLOR` is set. -[dev] -# Change the default port from 3000 to 5000 -# Also inherited by Bun.serve -port = 5000 +--- +- `DO_NOT_TRACK` +- If `DO_NOT_TRACK=1`, then analytics are [disabled](https://do-not-track.dev/). Bun records bundle timings (so we can answer with data, "is Bun getting faster?") and feature usage (e.g., "are people actually using macros?"). The request body size is about 60 bytes, so it's not a lot of data. + +{% /table %} + +## smol mode + +To reduce Bun's memory footprint in the runtime and test runner, pass `--smol`. + +```bash +$ bun --smol ./my-script.ts ``` + +This configures JavaScriptCore (the engine) to use a smaller heap size and run the garbage collector more frequently. This is currently disabled by default for performance reasons, but it may become the default in the future. This feature was introduced in Bun v0.6.15. |