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

1.0.1 • Public • Published

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 )

Package Sidebar

Install

npm i vite-plugin-env

Weekly Downloads

353

Version

1.0.1

License

MIT

Unpacked Size

3.36 kB

Total Files

5

Last publish

Collaborators

  • zouloux