vite-plugin-env-compatible
v2.0.1
Published
Environment Variables Compatible
Downloads
372,821
Readme
vite-plugin-env-compatible
inject to process.env like vue-cli or create-react-app and also define client
process.env.XXXfor you.
Motivation
viteexpose env toimport.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_orREACT_APP_and loaded to process.env~~(support by [email protected]). - 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
