bun-hot-reloading

Solid

Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

Data & Documents 162 stars 25 forks Updated 2 weeks ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
74
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Bun Hot Reloading Bun provides built-in hot reloading for faster development cycles. ## Watch Mode vs Hot Mode | Feature | `--watch` | `--hot` | |---------|-----------|---------| | Behavior | Restart process | Reload modules | | State | Lost on reload | Preserved | | Speed | ~20ms restart | Instant reload | | Use case | Any file type | Bun.serve HTTP | ## Watch Mode (--watch) Restarts the entire process when files change. ```bash # Basic watch mode bun --watch run src/index.ts # Watch specific script bun --watch run dev # Watch with test runner bun --watch test ``` ### package.json Scripts ```json { "scripts": { "dev": "bun --watch run src/index.ts", "dev:server": "bun --watch run src/server.ts", "test:watch": "bun --watch test" } } ``` ### Watch Behavior - Watches imported files automatically - Triggers on any `.ts`, `.tsx`, `.js`, `.jsx` change - Also watches `.json` imports - Restarts with fresh state ## Hot Mode (--hot) Reloads modules in-place without restarting the process. ```bash bun --hot run src/server.ts ``` ### HTTP Server Hot Reload ```typescript // src/server.ts let counter = 0; // State preserved across hot reloads export default { port: 3000, fetch(req: Request) { counter++; return new Response(`Request #${counter}`); }, }; ``` ```bash bun --hot run src/server.ts ``` When you modify `server.ts`, the module reloads instantly while `counter` keeps its value. ### Bun.serve with Hot Reload ```typescript // src/...

Details

Author
secondsky
Repository
secondsky/claude-skills
Created
6 months ago
Last Updated
2 weeks ago
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category