vite-plugin-patch-env
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

logo of vite-plugin-patch-env repository

vite-plugin-patch-env

This plugin is used to patch environment variables from the system into Vite

English | 简体中文

Installation

pnpm i -D vite-plugin-patch-env

Usage

// vite.config.ts
import { defineConfig } from "vite";
import PathEnv from "vite-plugin-patch-env";

export default defineConfig({
  plugins: [PathEnv()],
});
> env
...
HOME=/Users/kejun
...
console.log(import.meta.env);
// output
// {
//   //...
//   VITE_HOME: "/Users/kejun"
//   //...
// }

see example

Options

export type EnvName = RegExp | string;

export interface Options {
  names?: EnvName | EnvName[];
}

use names to filter env, default patch all env

Package Sidebar

Install

npm i vite-plugin-patch-env

Weekly Downloads

41

Version

0.0.5

License

MIT

Unpacked Size

5.54 kB

Total Files

6

Last publish

Collaborators

  • kejunmao