mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
41 lines
833 B
Plaintext
41 lines
833 B
Plaintext
---
|
|
title: "Vite"
|
|
---
|
|
|
|
Prerequisite: [Install the CLI](/cli/overview)
|
|
|
|
## Initialize Infisical for your [Vite](https://vitejs.dev) app
|
|
|
|
```bash
|
|
# move to your Vite app
|
|
cd /path/to/project
|
|
|
|
# initialize infisical
|
|
infisical init
|
|
```
|
|
|
|
## Modify the start script in your `package.json`
|
|
|
|
```json
|
|
...
|
|
"scripts": {
|
|
"dev": "infisical run -- vite",
|
|
"build": "infisical run -- vite build",
|
|
"preview": "infisical run -- vite preview"
|
|
}
|
|
...
|
|
```
|
|
|
|
## Start your development server with environment variables injected
|
|
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
<Note>
|
|
Note that for environment variables to be exposed to the client, you'll have
|
|
to prefix them with `VITE_` and export them from the `vite.config.js` file.
|
|
Read more about that [here](https://vitejs.dev/guide/env-and-mode.html) and
|
|
[here](https://main.vitejs.dev/config).
|
|
</Note>
|