Skip to content

KeJunMao/vite-plugin-patch-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 13, 2023
fa4a4f9 · Jul 13, 2023

History

32 Commits
Oct 11, 2022
Dec 10, 2022
Oct 10, 2022
Oct 10, 2022
Oct 11, 2022
Oct 11, 2022
Oct 10, 2022
Jul 12, 2023
Jul 12, 2023
Oct 10, 2022
Dec 10, 2022
Oct 10, 2022

Repository files navigation

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