# @junobuild/vite-plugin

> A Vite plugin for Juno

Latest version **4.7.1** (published 2026-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @junobuild/vite-plugin
pnpm add @junobuild/vite-plugin
yarn add @junobuild/vite-plugin
bun add @junobuild/vite-plugin
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.7.1 |
| Published | 2026-03-14 |
| First published | 2023-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | David Dal Busco |
| Maintainers | peterpeterparker |
| Keywords | env, environment, variables, vite, vite-plugin, vitejs |

## Links

- npm: https://www.npmjs.com/package/@junobuild/vite-plugin
- Repository: https://github.com/junobuild/plugins
- Homepage: https://juno.build
- Issues: https://github.com/junobuild/plugins
- npm.io page: https://npm.io/package/@junobuild/vite-plugin

## Dependencies (1)

- [@junobuild/plugin-tools](https://npm.io/package/@junobuild/plugin-tools.md) *

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 4.7.1 (latest) — 2026-03-14
- 4.4.0-next-2025-11-14 (next) — 2025-11-14
- 4.7.0 — 2026-01-24
- 4.5.1 — 2026-01-05
- 4.5.0 — 2026-01-05
- 4.4.0 — 2025-11-09
- 4.3.0-next-2025-11-06 — 2025-11-06
- 4.3.0-next-2025-11-05 — 2025-11-05
- 4.3.0-next-2025-10-23 — 2025-10-23
- 4.3.0 — 2025-09-28
- 4.2.0 — 2025-09-25
- 4.1.5 — 2025-09-15
- 4.1.4 — 2025-08-14
- 4.1.3 — 2025-08-13
- 4.1.2 — 2025-07-15
- … 34 more at https://npm.io/package/@junobuild/vite-plugin/versions

## README

[![npm][npm-badge]][npm-badge-url]
[![license][npm-license]][npm-license-url]

[npm-badge]: https://img.shields.io/npm/v/@junobuild/vite-plugin
[npm-badge-url]: https://www.npmjs.com/package/@junobuild/vite-plugin
[npm-license]: https://img.shields.io/npm/l/@junobuild/vite-plugin
[npm-license-url]: https://github.com/junobuild/plugins/blob/main/LICENSE

# Juno Vite Plugin

A Vite plugin for [Juno].

## Getting started

The plugin automatically loads your Satellite and Orbiter IDs.

With these values, you can instantiate Juno in your code without the need to manually define environment variables.

```javascript
await Promise.all([initSatellite(), initOrbiter()]);
```

## Environment variables

Those following environment variables are injected by this plugin:

| Environment variable      | Value                                                                    |
| ------------------------- | ------------------------------------------------------------------------ |
| VITE_SATELLITE_ID         | Satellite ID from Juno config (per `mode`)                               |
| VITE_ORBITER_ID           | `undefined` in development, Orbiter ID from Juno config.                 |
| VITE_INTERNET_IDENTITY_ID | `rdmx6-jaaaa-aaaaa-aaadq-cai`                                            |
| VITE_ICP_LEDGER_ID        | `ryjl3-tyaaa-aaaaa-aaaba-cai`                                            |
| VITE_ICP_INDEX_ID         | `qhbym-qaaaa-aaaaa-aaafq-cai`                                            |
| VITE_NNS_GOVERNANCE_ID    | `rrkah-fqaaa-aaaaa-aaaaq-cai`                                            |
| VITE_CMC_ID               | `rkp4c-7iaaa-aaaaa-aaaca-cai`                                            |
| VITE_REGISTRY_ID          | `rwlgt-iiaaa-aaaaa-aaaaa-cai`                                            |
| VITE_CYCLES_LEDGER_ID     | `um5iw-rqaaa-aaaaq-qaaba-cai`                                            |
| VITE_CYCLES_INDEX_ID      | `ul4oc-4iaaa-aaaaq-qaabq-cai`                                            |
| VITE_SNS_WASM_ID          | `qaa6y-5yaaa-aaaaa-aaafa-cai`                                            |
| VITE_NNS_DAPP_ID          | `qoctq-giaaa-aaaaa-aaaea-cai`                                            |
| VITE_CONTAINER            | Container URL (emulator or custom); `undefined` by default in production |

> `VITE_` is the default prefix used by Vite. It can be customized as described in Vite's [documentation](https://vitejs.dev/guide/env-and-mode).

## Installation

```bash
npm i @junobuild/vite-plugin -D
```

## Usage

```javascript
// vite.config.js
import juno from '@junobuild/vite-plugin';

export default defineConfig({
  plugins: [juno()]
});
```

## Options

The plugin can be customized using the optional `juno` configuration object. This allows you to control how the Juno Docker container is used in your project, especially during local development or end-to-end (E2E) testing.

### `juno.container`

Use the container option to enable, disable, or fine-tune the use of [Juno Docker](https://github.com/junobuild/juno-docker).

You can provide:

- `false` — to disable the container entirely.
- `true` — to enable the container with default settings (only in development mode), which is also the default behavior.
- An object with the following fields:
  - `url` (`string`, optional): A custom container URL, including the port. Example: http://127.0.0.1:8000
  - `modes` (`string[]`, optional): An array of modes (e.g., ['development', 'test']) during which the container should be used.

By default, the container is mounted only in `development` mode.

```javascript
// vite.config.js
import juno from '@junobuild/vite-plugin';

export default defineConfig({
  plugins: [
    juno({
      container: {
        url: 'http://127.0.0.1:8000',
        modes: ['development', 'test']
      }
    })
  ]
});
```

## License

MIT © [David Dal Busco](mailto:david.dalbusco@outlook.com)

[juno]: https://juno.build

---
_Source: https://npm.io/package/@junobuild/vite-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
