Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zyyv/unplugin-vue-dotenv
Auto generate the corresponding `.env` file.
https://github.com/zyyv/unplugin-vue-dotenv
plugin unplugin vite
Last synced: 2 months ago
JSON representation
Auto generate the corresponding `.env` file.
- Host: GitHub
- URL: https://github.com/zyyv/unplugin-vue-dotenv
- Owner: zyyv
- License: mit
- Created: 2022-08-21T05:52:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T15:54:14.000Z (over 2 years ago)
- Last Synced: 2024-10-03T18:22:35.931Z (3 months ago)
- Topics: plugin, unplugin, vite
- Language: TypeScript
- Homepage:
- Size: 66.4 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unplugin-vue-dotenv
[![NPM version](https://img.shields.io/npm/v/unplugin-vue-dotenv?color=a1b858&label=)](https://www.npmjs.com/package/unplugin-vue-dotenv)
Auto generate the corresponding `.env` file.
## Install
```bash
npm i unplugin-vue-dotenv
```Vite
```ts
// vite.config.ts
import Dotenv from 'unplugin-vue-dotenv/vite'export default defineConfig({
plugins: [
Dotenv({ /* options */ }),
],
})
```Example: [`playground/`](./playground/)
Rollup
```ts
// rollup.config.js
import Starter from 'unplugin-vue-dotenv/rollup'export default {
plugins: [
Starter({ /* options */ }),
],
}
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-vue-dotenv/webpack')({ /* options */ })
]
}
```
Nuxt
```ts
// nuxt.config.js
export default {
buildModules: [
['unplugin-vue-dotenv/nuxt', { /* options */ }],
],
}
```> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)
Vue CLI
```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-vue-dotenv/webpack')({ /* options */ }),
],
},
}
```
esbuild
```ts
// esbuild.config.js
import { build } from 'esbuild'
import Starter from 'unplugin-vue-dotenv/esbuild'build({
plugins: [Starter()],
})
```
## Options
```ts
export interface Options {
/**
* Generate the corresponding `.env` file according to the mode
* @default [['']] // Only generate `.env` file
* @example [['test', true]] // Generate `.env.test` and `.env.test.local` files
*/
modes?: modeOpt[]
/**
* Filepath to generate corresponding .d.ts file.
* Default enabled when `typescript` is installed locally.
* Set `false` to disable.
*
* @default './env.d.ts'
*/
dts?: string | boolean
}
```