Skip to content

Automatically put the version file in your project dist folder

License

Notifications You must be signed in to change notification settings

yrming/vite-plugin-version

Repository files navigation

vite-plugin-version

NPM version

Get the version information from package.json, then automatically put the version file version.json in your project dist folder when packaging.

// package.json
{
  // ...
  "version": "0.0.1"
}
// dist/version.json
{
  "version": "0.0.1"
}

Install

npm i vite-plugin-version

Add plugin to your vite.config.ts:

// vite.config.ts
import { defineConfig } from 'vite'
import versionPlugin from 'vite-plugin-version'

export default defineConfig({
  plugins: [
    versionPlugin(),
  ],
})

License

MIT License © 2022 YRM