bun-runtime

Configure and run JavaScript and TypeScript applications with the Bun runtime CLI.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-runtime-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-runtime
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-runtime
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-runtime-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Developers working with the Bun runtime often struggle to remember correct CLI flag placement, watch versus hot reload behavior, bunfig.toml options, and module resolution rules, leading to misconfigured scripts and confusing import errors. ## Core Features & Use Cases - CLI Flag Guidance: Covers watch mode, hot reloading, debugging flags, preload scripts, env file loading, and workspace filtering with correct flag positioning. - bunfig.toml Configuration: Documents runtime, test runner, package manager, registry, and lockfile settings with complete examples. - Module Resolution Reference: Explains extension resolution order, ESM/CommonJS interop, package exports conditions, path aliases, and import.meta properties. - Use Case: When a developer sees "Cannot find module" after adding a path alias, the Skill directs them to the module resolution reference to fix tsconfig paths or package.json imports. ## Quick Start Ask how to run a TypeScript file with watch mode in Bun and get the correct command with flags in the right position.

Frequently Asked Questions about bun-runtime

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a TypeScript file with Bun?

Run TypeScript files directly with bun run index.ts or the shorthand bun index.ts, since Bun transpiles TypeScript and JSX on the fly. Add flags like --watch before the run command, for example bun --watch run index.ts.

What is the difference between bun --watch and bun --hot?

The --watch flag performs a full process restart when files change, while --hot does hot module replacement that preserves application state and connections. Use --hot for servers where you want to keep in-memory state during development.

Does Bun load .env files automatically?

Bun automatically loads .env, .env.local, and .env.development files when running scripts. You can specify a different file with bun --env-file .env.production run index.ts or disable auto-loading by setting env = false in bunfig.toml.

Why is bun --watch not working with my script?

The most common cause is flag position: Bun flags must come immediately after bun, before run. Use bun --watch run dev, because bun run dev --watch passes the flag to your script instead of Bun.

How does Bun resolve imports without file extensions?

Bun checks extensions in order: .tsx, .jsx, .ts, .mjs, .js, .cjs, .json, then index files in the directory. Importing a .js path also matches a corresponding .ts file for TypeScript compatibility.

Can Bun run package.json scripts in monorepo workspaces?

Yes, use bun run --filter 'pkg-*' build to run a script in matching workspace packages, or --filter '*' to run it in all workspaces. Bun also respects npm lifecycle hooks like preclean and postclean.