2025-12-16 10:20:31 -07:00
|
|
|
# bun run
|
|
|
|
|
|
|
|
|
|
> Execute a JavaScript/TypeScript file, or a script from `package.json`.
|
2026-02-18 06:55:01 -07:00
|
|
|
> More information: <https://bun.com/docs/runtime>.
|
2025-12-16 10:20:31 -07:00
|
|
|
|
|
|
|
|
- Run a script defined in `package.json`:
|
|
|
|
|
|
|
|
|
|
`bun run {{script_name}}`
|
|
|
|
|
|
|
|
|
|
- Run a JavaScript or TypeScript file directly:
|
|
|
|
|
|
|
|
|
|
`bun run {{path/to/file.ts}}`
|
|
|
|
|
|
|
|
|
|
- Run a file in "watch" mode (restarts automatically when the file changes):
|
|
|
|
|
|
|
|
|
|
`bun run --watch {{path/to/file.ts}}`
|
|
|
|
|
|
|
|
|
|
- Run a file using a specific configuration file:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`bun run {{[-c|--config]}} {{path/to/bunfig.toml}} {{path/to/file.ts}}`
|