Skip to content

Instantly share code, notes, and snippets.

View goldenstein64's full-sized avatar
๐ŸŒ
web dev

goldenstein64

๐ŸŒ
web dev
View GitHub Profile
@goldenstein64
goldenstein64 / bun-build-watch.ts
Last active February 16, 2025 15:03
Dependency-aware Bun.build file watcher
/**
* implements a dependency-aware file watcher that calls `Bun.build` whenever a
* file change occurs
*
* - It uses an experimental API, `import.meta.resolve` with two arguments.
* - It uses these Bun APIs:
* - `Bun.build`
* - `Bun.file`
* - `Bun.Transpiler`
* - `Bun.resolveSync`