File SystemRuntime & Debugging
Build-time constants with --define
Pass --define to bun build or bun build --compile to inject build-time constants into your application. Use it to embed metadata like build versions,
Inspect memory usage using V8 heap snapshots
Bun implements V8's heap snapshot API. Use it to capture the heap at runtime and debug memory leaks in your JavaScript/TypeScript application.
Define and replace static globals & constants
The --define flag declares statically-analyzable constants and globals. It replaces all usages of an identifier or property in a JavaScript or TypeScript file