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

2.0.1 • Public • Published

vite-plugin-env-compatible

inject to process.env like vue-cli or create-react-app and also define client process.env.XXX for you.

wakatime NPM Publish downloads npm version License: MIT

Motivation

  • vite expose env to import.meta.env.PREFIX_XXX, but not loaded to process.env like vue-cli or create-react-app.
  • this plugin support setting prefix like VUE_APP_ or REACT_APP_ and loaded to process.env(support by vite@2.5.1).
  • built-in with vue-cli-plugin-vite just for compatibility.

Usage

yarn add vite-plugin-env-compatible
// vite.config.ts
import env from 'vite-plugin-env-compatible'

// @see https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    // ...other plugins
    env(/* options */)
  ],
})

Options

Underlying

  • dotenv & dotenv-expand
  • vite

Further

Dependents (9)

Package Sidebar

Install

npm i vite-plugin-env-compatible

Weekly Downloads

55,991

Version

2.0.1

License

MIT

Unpacked Size

9.15 kB

Total Files

6

Last publish

Collaborators

  • indexxuan