Consistent Git-based Build ID for Next.js
JSON →next-build-id is a utility package for Next.js applications, currently at version 3.0.0. It addresses a common issue in multi-server deployments where different instances of a Next.js app might have varying build IDs, leading to "invalid build file hash" errors for clients. This package provides a mechanism to generate a consistent build ID, derived from the local Git repository's state, specifically the latest commit hash (`git rev-parse HEAD`) or a description based on the most recent Git tag (`git describe --tags`). It exports an asynchronous function (the primary export) and a synchronous variant, both intended to be used with Next.js's `generateBuildId` configuration option in `next.config.js`. The package helps ensure that all deployed instances of a Next.js application serve assets built with the same identifier, crucial for load-balanced environments without sticky sessions where apps are built directly on each server.
Traffic · last 30 days ↓75% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇮 Finland · CO · 🇩🇪 Germany