1.0.1 • Published 2 years ago

vite-plugin-env v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Vite plugin Env

Inject custom envs into your vite bundle.

Install

npm i -D vite-plugin-env

vite.config.js

import { resolve } from "path"
import { env } from "vite-plugin-stachtml"
export default defineConfig( viteConfig => {
	return {
		build: {
			rollupOptions: {
				input: [ resolve('src/index.html') ]
			},
			outDir: resolve('dist'),
		},
		plugins: {
			env({
				MY_CUSTOM_ENV : "Hello from vite config"
			})
		}
	}
})

index.ts

console.log( import.meta.env.MY_CUSTOM_ENV )