A Vite plugin for Internet Computer Canister Dapp development configuration.
Provides development configuration for Canister Dapps that use My Canister Dashboard. The dashboard infers it's environment at runtime, because it is statically included the Rust crate. This plugin serves (in dev server) and emits (in dev builds) a static canister-dashboard-dev-config.json
file that the dashboard can use to determine its development environment. This way, you can use the dashboard locally with dfx.
npm install --save-dev @web3nl/vite-plugin-canister-dapp
Add the plugin to your vite.config.ts
:
import { defineConfig } from 'vite';
import { canisterDashboardDevConfig } from '@web3nl/vite-plugin-canister-dapp';
export default defineConfig({
plugins: [canisterDashboardDevConfig()],
});
Create a .env.development
file with the following required variables:
VITE_II_CANISTER_ID=
VITE_DFX_PROTOCOL=
VITE_DFX_HOSTNAME=
VITE_DFX_PORT=
Optional variables:
VITE_CANISTER_ID=
Full API documentation is available at GitHub Pages.