{"id":21934,"library":"rollup-plugin-build-git-version","title":"rollup-plugin-build-git-version","description":"A Rollup plugin that generates a version.json file containing git information (branch, commit id, time, message, author) and build time during the bundle process. Current version 0.0.9 is stable but likely early-stage; release cadence is unknown. Key differentiator: provides structured git metadata directly in the output, useful for CI/CD pipelines and runtime version display. Supports Node >=16 and pnpm 8.x. Ships TypeScript types. Note that the plugin uses require() in its own example, but Rollup encourages ESM imports.","status":"maintenance","version":"0.0.9","language":"javascript","source_language":"en","source_url":"https://github.com/peritot/rollup-plugin-build-git-version","tags":["javascript","rollup-plugin","version","typescript"],"install":[{"cmd":"npm install rollup-plugin-build-git-version","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-build-git-version","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-build-git-version","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Plugin uses ESM named export; require() may fail in ESM contexts or with Rollup's ESM-first approach.","wrong":"const buildGitVersion = require('rollup-plugin-build-git-version')","symbol":"buildGitVersion","correct":"import { buildGitVersion } from 'rollup-plugin-build-git-version'"},{"note":"Plugin does not have a default export; using default import will result in undefined or error.","wrong":"import { default as buildGitVersion } from 'rollup-plugin-build-git-version'","symbol":"default","correct":"import buildGitVersion from 'rollup-plugin-build-git-version'"},{"note":"Type is not exported; use typeof import(...) for custom types if needed.","wrong":"import { BuildGitVersion } from 'rollup-plugin-build-git-version'","symbol":"buildGitVersion type","correct":"import type { BuildGitVersion } from 'rollup-plugin-build-git-version'"}],"quickstart":{"code":"import { buildGitVersion } from 'rollup-plugin-build-git-version';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  output: { dir: 'dist', format: 'cjs' },\n  plugins: [buildGitVersion()]\n});","lang":"typescript","description":"This example shows how to integrate the plugin into a Rollup configuration, generating version.json in the output directory."},"warnings":[{"fix":"Use import { buildGitVersion } from 'rollup-plugin-build-git-version'.","message":"The plugin example uses CommonJS require() but the package is ESM-only (has type: 'module' or uses ESM syntax).","severity":"gotcha","affected_versions":">0.0.1"},{"fix":"Consider using before/after hooks or custom plugin to merge if needed.","message":"The generated version.json always overwrites the output; there is no option to merge with existing file.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update Node to >=16, or use an alternative if stuck on older Node.","message":"Plugin requires Node >=16 and pnpm >=8. Using older versions may fail due to unsupported APIs.","severity":"breaking","affected_versions":">=0.0.9"},{"fix":"Use Rollup's manual output or another plugin to move the file post-build.","message":"The version.json is created at the root of the output directory; cannot change path without workaround.","severity":"gotcha","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install --save-dev rollup-plugin-build-git-version","cause":"Package not installed or missing devDependency.","error":"Error: Cannot find module 'rollup-plugin-build-git-version'"},{"fix":"Use import { buildGitVersion } from 'rollup-plugin-build-git-version'.","cause":"Using default import instead of named import.","error":"TypeError: buildGitVersion is not a function"},{"fix":"Switch to import syntax or use dynamic import().","cause":"Using require() with an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}