{"id":21910,"library":"rollup-plugin-add-git-msg","title":"rollup-plugin-add-git-msg","description":"Rollup plugin that prepends a banner comment with GIT_TAG and COMMITHASH from the last git commit or tag, along with the repo name, copyright, and compilation date. Current published version is 1.1.0 with no recent updates; appears to be in maintenance mode. Key differentiator: simple, zero-config plugin for adding standard git-based versioning banners to Rollup bundles. Alternatives like rollup-plugin-banner or manual inject plugins offer more flexibility but require more setup.","status":"maintenance","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/oplinjie/rollup-plugin-add-git-msg","tags":["javascript","git","rollup","plugin","version"],"install":[{"cmd":"npm install rollup-plugin-add-git-msg","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-add-git-msg","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-add-git-msg","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for creating filter patterns and utilities","package":"@rollup/pluginutils","optional":false},{"reason":"Spawns git commands to retrieve tag and commit hash","package":"child_process","optional":false}],"imports":[{"note":"Default export only; named import will fail.","wrong":"import { addGitMsg } from 'rollup-plugin-add-git-msg';","symbol":"addGitMsg","correct":"import addGitMsg from 'rollup-plugin-add-git-msg';"},{"note":"When using require(), the plugin is exported as a CommonJS module with a default export, so you need .default.","wrong":"const addGitMsg = require('rollup-plugin-add-git-msg');","symbol":"addGitMsg (CommonJS)","correct":"const addGitMsg = require('rollup-plugin-add-git-msg').default;"},{"note":"TypeScript handles default imports correctly if esModuleInterop is enabled.","wrong":"","symbol":"addGitMsg (TypeScript)","correct":"import addGitMsg from 'rollup-plugin-add-git-msg';"}],"quickstart":{"code":"import addGitMsg from 'rollup-plugin-add-git-msg';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'iife'\n  },\n  plugins: [\n    addGitMsg({\n      copyright: 'MyCompany',\n      showDate: true,\n      showTag: true,\n      showCommitID: true\n    })\n  ]\n};","lang":"javascript","description":"Shows how to import and configure the plugin in a Rollup config file."},"warnings":[{"fix":"Ensure the build runs inside a git repository. Consider adding a check or using an alternative plugin that throws errors for missing git info.","message":"The plugin will fail silently if executed outside a git repository—no git info is injected and no error is thrown.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"For production builds, consider using an asynchronous plugin or running git commands outside the build pipeline.","message":"The plugin uses synchronous child_process.execSync to run git commands, which blocks the event loop and may cause performance issues in large builds.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check compatibility with your Rollup version. For Rollup 3+, you may need to use a more recent alternative like rollup-plugin-banner.","message":"Package has not been updated since 2017. May not work with modern Rollup versions (e.g., Rollup 3+).","severity":"deprecated","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":"Run `npm install --save-dev rollup-plugin-add-git-msg` and ensure it is listed in your package.json.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'rollup-plugin-add-git-msg'"},{"fix":"Use `import addGitMsg from 'rollup-plugin-add-git-msg';` (no braces) or for CommonJS: `const addGitMsg = require('rollup-plugin-add-git-msg').default;`","cause":"Incorrect import style: using named import instead of default import.","error":"TypeError: addGitMsg is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}