The Vite plugin writes a version JSON file based on the generated manifest.
Know when a new Vite build lands.
buildwatch generates deployment version metadata during your Vite build and watches it from the browser so your app can react the moment a new build is available.
npm install buildwatch
// Vite writes version.json
// Browser checks when the page is visible
// Your app prompts, reloads, or notifies
Small package. Clear deployment signal.
Pair a Vite build plugin with a browser watcher to detect when the deployed app no longer matches the code your user has loaded.
The watcher fetches the version file immediately and again when the document becomes visible.
Run your callback when the deployed build version changes so you can prompt, reload, or notify.
Install, plug in, watch.
Requires Node 24+ and Vite 5+. Enable Vite's manifest output, add the plugin, then start the browser watcher.
Vite setup
By default, buildwatch reads Vite's manifest and writes version.json beside it.
import { defineConfig } from "vite";
import { versionJsonPlugin } from "buildwatch/version-json-plugin";
export default defineConfig({
build: {
manifest: true,
},
plugins: [versionJsonPlugin()],
});
Browser usage
The watcher checks /build/version.json by default and throttles checks to once per minute.
import watchVersion from "buildwatch";
const stopWatching = watchVersion((newVersion, oldVersion) => {
console.log(`New build available: ${oldVersion} -> ${newVersion}`);
});
stopWatching();
Tune the file paths and check cadence.
Keep the defaults or align the output and watcher URL with your Vite build directory.
Ship updates without leaving users behind.
Use buildwatch when a single-page app needs a dependable signal that a newer deployed build is ready.
Get the package