Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/susickypavel/vite-require-env-var
Vite.js plugin that makes build fail if a required environment variable(s) is missing
https://github.com/susickypavel/vite-require-env-var
vite vite-plugin
Last synced: 22 days ago
JSON representation
Vite.js plugin that makes build fail if a required environment variable(s) is missing
- Host: GitHub
- URL: https://github.com/susickypavel/vite-require-env-var
- Owner: susickypavel
- License: mit
- Created: 2022-08-24T19:52:28.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-25T09:43:28.000Z (about 2 years ago)
- Last Synced: 2024-10-24T11:14:48.989Z (23 days ago)
- Topics: vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 113 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vite-require-env-var
Vite.js plugin that makes build fail if a required environment variable(s) is missing.
It supports all .env.\* files (even combined)
- .env
- .env.local
- .env.[mode]![Example CLI output by vite-require-env-var plugin](./docs/images/example.png)
# 1. Installation
## 1.1 Install dependency
```sh
# npm
npm i -D vite-require-env-var# yarn
yarn add -D vite-require-env-var# pnpm
pnpm add -D vite-require-env-var
```## 1.2 Add to Vite configuration file
```ts
import { defineConfig } from "vite";
import { requireEnvVar } from "vite-require-env-var";export default defineConfig({
plugins: [requireEnvVar(["VARIABLE_1", "VITE_URL"])],
});
```