unplugin-typedotenv
v0.2.2
Published
typedotenv plugin for webpack/vite (dotenv utility for TypeScript)
Downloads
4,285
Maintainers
Readme
unplugin-typedotenv
typedotenv with unplugin.
You can generate TypeScript code from .env
file.
When you edit the .env
file, the file is re-created.
Setup
npm install --save-dev unplugin-typedotenv
// vite.config.ts
import typedotenv from 'unplugin-typedotenv/vite'
export default defineConfig({
plugins: [typedotenv({ output: 'src/env.ts' })],
})
// rollup.config.js
import typedotenv from 'unplugin-typedotenv/rollup'
export default {
plugins: [typedotenv({ output: 'src/env.ts' })],
}
// esbuild.config.js
import { build } from 'esbuild'
build({
plugins: [require('unplugin-typedotenv/esbuild')({ output: 'src/env.ts' })],
})
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-typedotenv/webpack')({ output: 'src/env.ts' })],
}