# React / Vite

Source : https://webgune.cloud/en-us/docs/web-react · Mis à jour le 2026-10-27

# React / Vite

Detection relies on the presence of `vite.config.js` or `vite.config.ts` (applicable to React, Vue, or Svelte served by Vite).

## What the auto builder runs

```bash
npm install
npm run build     # vite build → dist/ folder
# the contents of dist/ are then served as static files
```

Unlike a typical Node server, there's no application process to run after the build: the result is static HTML/CSS/JS.

## Environment variables

Vite only exposes variables prefixed with `VITE_` to the bundle:

```bash
VITE_API_URL=https://api.mon-domaine.com
VITE_APP_NAME=MonApp
```

```typescript
const apiUrl = import.meta.env.VITE_API_URL;
```

> These variables are injected **at build time**, not at runtime. Changing their value requires a redeployment for it to take effect.

## Client-side routing

If you use React Router (or equivalent) in `BrowserRouter` mode, make sure the service redirects unknown routes to `index.html`, otherwise a refresh on a deep route will return a 404.
