Skip to content

Commit 056bde6

Browse files
committed
feat(docs): added vite plugin documentation
1 parent eaffb73 commit 056bde6

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

docs/astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default defineConfig({
3131
{ label: 'Node.js', link: '/integrations/loader/' },
3232
{ label: 'Rollup', link: '/integrations/rollup/' },
3333
{ label: 'Webpack', link: '/integrations/webpack/' },
34-
// { label: 'Vite', link: '/integrations/vite/' },
34+
{ label: 'Vite', link: '/integrations/vite/' },
3535
// { label: 'Babel', link: '/integrations/webpack/' },
3636
// { label: 'Jest', link: '/integrations/jest/' },
3737
// { label: 'SWC', link: '/integrations/swc/' },
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
11
---
22
title: Vite
3-
---
3+
---
4+
5+
## Install
6+
7+
```console
8+
npm add @dotenv-run/vite --save-dev
9+
```
10+
11+
## Usage
12+
13+
Create a `vite.config.js` [configuration file](https://vite.dev/config) and import the plugin:
14+
15+
```js
16+
import env from "@dotenv-run/vite";
17+
18+
export default {
19+
envPrefix: 'MY_PREFIX_',
20+
envDir: './my-env-directory',
21+
plugins: [env()],
22+
};
23+
```
24+
25+
Then call `vite` or `vite build` either via the [CLI](https://vite.dev/guide/cli.html).
26+
27+
The available options are similar to those supported by [`@dotenv-run/core`](https://www.npmjs.com/package/@dotenv-run/core), but this plugin seamlessly integrates with Vite by automatically deriving the root, prefix, and environment values from its standard configuration, ensuring a more cohesive experience. For more details, refer to the API section.

0 commit comments

Comments
 (0)