npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-build-id

v0.6.0

Published

Automatically generates build_id after production compiled

Readme

vite-plugin-build-id

A Vite plugin that automatically generates a unique build_id each time the project is compiled.

Developed by 0xJacky and Hintay.

Install

pnpm i -D vite-plugin-build-id

Usage

In vite.config.ts:

import { defineConfig } from 'vite'
import vitePluginBuildId from 'vite-plugin-build-id'

export default defineConfig({
  plugins: [vitePluginBuildId()]
})

This will create a version.json file in your src folder with the following structure:

{
  "version": "{the-verion-in-package.json}",
  "build_id": 1,
  "total_build": 1
}
  • version: Mirrors the version field from your package.json.
  • build_id: Starts at 1 for each new version and increments with each build.
  • total_build: Tracks the total number of builds since the plugin was first configured.

If you leave the disableBumpSameStatus option enabled (its default setting), a .status_hash file will be created in the root directory to monitor file changes within the workspace. This file helps the plugin determine whether to increment the build_id.

To prevent it from being tracked by version control, add the following entry to your .gitignore file:

**/.status_hash

Tips

If you'd like to use a CI build number as the build_id, set the buildIdEnv option. For example, in a Drone CI environment:

import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    vitePluginBuildId({
      buildIdEnv: 'DRONE_BUILD_NUMBER',
    }),
  ]
})

Options

interface Options {
  /**
   * Prepares the version file before the Vite build process
   *
   * Default: `false`
   * Useful for special cases where the version file needs to be available before the build.
   */
  prepare?: boolean

  /**
   * Specifies the destination folder
   *
   * Default is `src`
   */
  destination?: string

  /**
   * Enables inclusion of the latest git commit hash
   *
   * Default is `false`
   * Compare git's commit hash with the last time it was generated to avoid unwanted build id bump.
   */
  enableCommitHash?: boolean

  /**
   * Disables build ID increment when no changes are detected in the git workspace
   *
   * Default is `true`
   * Prevents `build_id` from incrementing if the current workspace status is unchanged.
   */
  disableBumpSameStatus?: boolean

  /**
   * Specifies the environment variable for setting the build ID
   *
   * Default is `true`
   * Useful for integrating CI/CD build numbers as the build ID.
   */
  buildIdEnv?: string
}