Registry / devops / vite-plugin-version-mark

vite-plugin-version-mark

JSON →
library0.2.2jsnpmunverified

A Vite and Nuxt plugin (v0.2.2) that automatically injects version information from package.json, git commit SHA, or custom commands into your application via console logs, global variables, meta tags, and static output files. It supports multi-command execution with custom format templates, aliases, timeouts, and fallbacks. Particularly useful for tracking deployed builds and debugging in production. Ships TypeScript types. Requires Vite or Nuxt 3.3+. Released under MIT.

npm install vite-plugin-version-mark
INSTALL
IMPORT
SIG · VITE-PLUGIN-VERSIO
V
vite-plugin-version-mark
devopsjavascriptv0.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

vitePluginVersionMark
import { vitePluginVersionMark } from 'vite-plugin-version-mark'
import vitePluginVersionMark from 'vite-plugin-version-mark'
Named export only; no default export. ESM-only, not CJS compatible.
VitePluginVersionMarkInput
import type { VitePluginVersionMarkInput } from 'vite-plugin-version-mark'
import { VitePluginVersionMarkInput } from 'vite-plugin-version-mark'
TypeScript type import; do not use as value.
nuxtModule
import { nuxtModule } from 'vite-plugin-version-mark/nuxt'
import { nuxtModule } from 'vite-plugin-version-mark'
Nuxt module is a separate entry point from 'vite-plugin-version-mark/nuxt'.

Minimal setup for Vite: enables short git SHA, meta tags, console log, and global variable injection.

// vite.config.ts import { defineConfig } from 'vite'; import { vitePluginVersionMark } from 'vite-plugin-version-mark'; export default defineConfig({ plugins: [ vitePluginVersionMark({ ifShortSHA: true, ifMeta: true, ifLog: true, ifGlobal: true, }), ], });
Debug
Known issues
deprecatedThe 'ifGitSHA' option was deprecated in v0.0.12; use 'ifShortSHA' instead.
fix
Replace 'ifGitSHA: true' with 'ifShortSHA: true' in plugin config.
affects: <0.0.12
breakingIn v0.2.0, the 'command' option was replaced by multi-command support using an object or array format.
fix
Migrate single 'command' string to new format: e.g., { commands: [{ command: 'git rev-parse --short HEAD', alias: 'sha' }] }.
affects: >=0.2.0
gotchaThe global variable is injected via a script tag in the HTML <head> (since v0.1.3).
fix
Access global variable like `__APP_VERSION__` after DOMContentLoaded if needed.
affects: >=0.1.3
gotchaNuxt module requires @nuxt/kit and @nuxt/schema >3.3.0 as peer dependencies.
fix
Ensure Nuxt 3.3+ is installed in your project.
affects: >=0.1.0
deprecatedThe 'outputFile' option was added in v0.1.1; older versions have no file output support.
fix
Upgrade to v0.1.1+ or use a custom plugin to write version file.
affects: <0.1.1
Errors
Common errors & fixes
Failed to load url /@vite-plugin-version-mark/nuxt (resolved id: /@vite-plugin-version-mark/nuxt)
Importing nuxt module from the main package path instead of subpath.
fix
Use `import { nuxtModule } from 'vite-plugin-version-mark/nuxt'` or load as module in nuxt.config.
Module '"vite-plugin-version-mark"' has no default export
Attempting to import the plugin as default export.
fix
Use named import: `import { vitePluginVersionMark } from 'vite-plugin-version-mark'`.
TypeError: Cannot read properties of undefined (reading 'version')
The plugin cannot read package.json if the command is not run from the project root.
fix
Ensure the Vite/Nuxt config file is at the project root, or explicitly set 'name' and 'version' in plugin options.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies
viterequiredpeer dependency for Vite-based projects
@nuxt/kitoptionalpeer dependency for Nuxt integration
@nuxt/schemaoptionalpeer dependency for Nuxt integration
Agent activity
4 hits · last 30 days
node
4
Resources
vite-plugin-version-mark — npm install vite-plugin-version-mark · libregistry