Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sws2apps/vite-plugin-package-version
Vite Plugin to load package version into environment variables
https://github.com/sws2apps/vite-plugin-package-version
nodejs package-json package-version vite vite-plugin vitejs
Last synced: about 2 months ago
JSON representation
Vite Plugin to load package version into environment variables
- Host: GitHub
- URL: https://github.com/sws2apps/vite-plugin-package-version
- Owner: sws2apps
- License: mit
- Archived: true
- Fork: true (smnhgn/vite-plugin-package-version)
- Created: 2022-12-17T22:38:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T09:32:58.000Z (7 months ago)
- Last Synced: 2024-09-21T22:05:50.011Z (about 2 months ago)
- Topics: nodejs, package-json, package-version, vite, vite-plugin, vitejs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@sws2apps/vite-plugin-package-version
- Size: 577 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Vite Plugin to Display Package Version
DISCLAIMER: As the original package from [smnhgn/vite-plugin-package-version](https://github.com/smnhgn/vite-plugin-package-version) now supports ESM, we will be soon deprecating this package.
Load package version of your package.json into your [vite](https://github.com/vitejs/vite) environment.
Will inject `import.meta.env.PACKAGE_VERSION` with the version specified in your package.json.
## Installation
```
npm i @sws2apps/vite-plugin-package-version
```## Usage
```js
// vite.config.js
import { defineConfig } from 'vite';
import { loadVersion } from '@sws2apps/vite-plugin-package-version';export default defineConfig({
plugins: [loadVersion()],
});
```## Note
This repo is taken from [vite-plugin-package-version](https://github.com/smnhgn/vite-plugin-package-version) by Simon Haugen with only some minor edits. Thanks to Simon for the original repo.