# vite-plugin-build-metadata

> Create Vite build meta

Latest version **1.2.0** (published 2025-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-build-metadata
pnpm add vite-plugin-build-metadata
yarn add vite-plugin-build-metadata
bun add vite-plugin-build-metadata
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2025-04-25 |
| First published | 2022-12-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | daniil4udo |
| Maintainers | daniil4udo |
| Keywords | vite-plugin |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-build-metadata
- Repository: https://github.com/daniil4udo/vite-plugin-build-metadata
- Issues: https://github.com/daniil4udo/vite-plugin-build-metadata/issues
- Funding: https://github.com/sponsors/daniil4udo
- npm.io page: https://npm.io/package/vite-plugin-build-metadata

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2025-04-25
- 1.1.0 — 2025-02-27
- 1.0.2 — 2025-02-02
- 1.0.1 — 2025-02-02
- 1.0.0 — 2025-02-02
- 0.5.0 — 2024-05-06
- 0.4.0 — 2023-09-18
- 0.3.2 — 2023-09-05
- 0.3.1 — 2023-09-04
- 0.3.0 — 2023-09-04
- 0.2.0 — 2023-05-29
- 0.1.1 — 2022-12-25

## README

<h2 align='center'><samp>vite-plugin-build-metadata</samp></h2>

<p align='center'>Create Vite build meta</p>

<p align='center'>
<a href='https://www.npmjs.com/package/vite-plugin-build-metadata'>
<img src='https://img.shields.io/npm/v/vite-plugin-build-metadata?color=222&style=flat-square'>
</a>
</p>

<br>

## 💙 SPECIAL SPONSOR

<!--special start-->

<p align="center">
  <a href="https://www.democrance.com" target="_blank">
    <img width="260px" src="https://www.democrance.com/wp-content/uploads/2023/02/democrance-logo.svg">
  </a>
</p>

## Usage

### Installation

Install the vite-plugin-build-metadata package as a development dependency using pnpm:

```bash
pnpm i vite-plugin-build-metadata -D
```

## Configuration

Add the plugin to your `vite.config.js` file:

```ts
// vite.config.js
import VitePluginBuildMetadata from 'vite-plugin-build-metadata';

export default {
    plugins: [
        VitePluginBuildMetadata(),
    ],
};
```

Once the plugin is installed and configured, it will generate a file in the root build directory (default filename: meta.json) after each build. This file will contain the following information:

```json
{
    "buildHash": "GENERATED_BUILD_HASH",
    "commitHash": "LAST_COMMIT_HASH",
    "date": "BUILD_DATE"
}
```

You can customize the filename by passing an options object to the VitePluginBuildMetadata constructor:

```ts
// vite.config.js
import VitePluginBuildMetadata from 'vite-plugin-build-metadata';

export default {
    plugins: [
        VitePluginBuildMetadata({ filename: 'custom-meta.json' }), // or without .json extension
    ],
};
```

## Motivation

The `vite-plugin-build-metadata` plugin provides a way to determine the relevance of the deployed version of a frontend application. By including build and commit hashes, as well as the build date, in the generated metadata file, you can easily track and verify the version of your application in production.

This information can be useful in various scenarios, such as:

- Ensuring that the correct version of the application is deployed in production environments.
- Debugging issues by identifying the specific build and commit associated with a deployed version.
- Comparing different builds to track changes and assess their impact.

Including build metadata in your frontend builds adds an extra layer of transparency and accountability to your development process.

## License

MIT License © 2021 [Daniil Chumachenko](https://github.com/daniil4udo)

---
_Source: https://npm.io/package/vite-plugin-build-metadata · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
