A Vite plugin for Juno
npm install @junobuild/vite-plugin[![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
A Vite plugin for [Juno].
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()]);
Those following environment variables are injected by this plugin:
| Environment variable | Value |
| ------------------------- | ------------------------------------------------------------------------ |
| VITE_SATELLITE_ID | Satellite ID from Juno config (per mode) |undefined
| VITE_ORBITER_ID | in development, Orbiter ID from Juno config. |rdmx6-jaaaa-aaaaa-aaadq-cai
| VITE_INTERNET_IDENTITY_ID | |ryjl3-tyaaa-aaaaa-aaaba-cai
| VITE_ICP_LEDGER_ID | |qhbym-qaaaa-aaaaa-aaafq-cai
| VITE_ICP_INDEX_ID | |rrkah-fqaaa-aaaaa-aaaaq-cai
| VITE_NNS_GOVERNANCE_ID | |rkp4c-7iaaa-aaaaa-aaaca-cai
| VITE_CMC_ID | |rwlgt-iiaaa-aaaaa-aaaaa-cai
| VITE_REGISTRY_ID | |um5iw-rqaaa-aaaaq-qaaba-cai
| VITE_CYCLES_LEDGER_ID | |ul4oc-4iaaa-aaaaq-qaabq-cai
| VITE_CYCLES_INDEX_ID | |qaa6y-5yaaa-aaaaa-aaafa-cai
| VITE_SNS_WASM_ID | |qoctq-giaaa-aaaaa-aaaea-cai
| VITE_NNS_DAPP_ID | |undefined
| VITE_CONTAINER | Container URL (emulator or custom); by default in production |
> VITE_ is the default prefix used by Vite. It can be customized as described in Vite's documentation.
`bash`
npm i @junobuild/vite-plugin -D
`javascript
// vite.config.js
import juno from '@junobuild/vite-plugin';
export default defineConfig({
plugins: [juno()]
});
`
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.
Use the container option to enable, disable, or fine-tune the use of 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.url
- An object with the following fields:
- (string, optional): A custom container URL, including the port. Example: http://127.0.0.1:8000modes
- (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']
}
})
]
});
``
MIT © David Dal Busco
[juno]: https://juno.build