Skip to content
RedStar071

RedStar071/unplugin-version-injector

LibraryLive in production

Universal plugin to inject your package version or current date into built files, supporting Vite, Rollup, Rolldown, esbuild, Webpack, Rspack, and Farm.

Universal plugin to inject your package version or current date into built files, supporting Vite, Rollup, Rolldown, esbuild, Webpack, Rspack, and Farm.

1 0TypeScriptPush 26d agoListed 1mo ago1 open issueMIT
nodejsoxcoxfmtoxlintunplugin
  • TypeScript98.8%
  • JavaScript1.0%
  • Shell0.2%
View on GitHub

Report a problem

1 Review

@redstardev/unplugin-version-injector is a narrow developer tool that solves a real packaging annoyance cleanly: injecting a package version or current date into built files without importing package.json, reading files at runtime, or manually updating constants. The README is excellent for a library of this size. It explains the motivation, supports Vite, Rollup, Rolldown/tsdown, esbuild, Webpack, Rspack, and Farm, gives concrete examples for TS/JS, JSON, CSS, and text, documents every option, and includes migration notes from the older esbuild-only package. The implementation is also appropriately small and readable. It uses unplugin, resolves options centrally, replaces a configurable inject tag, reads package.json safely through @sapphire/result, supports current-date mode, and handles esbuild separately by patching outputs through onEnd where needed. The package metadata looks professional too: exports per bundler, peer dependencies marked optional, lint/typecheck/test scripts, conventional commit tooling, and Node/pnpm engine requirements. The biggest improvement would be adding more visible examples for edge cases: monorepos with nested package files, missing/invalid package JSON behavior, watch mode expectations, and source maps if replacement happens after output. The version is still early at 0.0.3, so compatibility tests across all advertised bundlers will matter a lot.