Skip to content
IC Reactor

Codegen in Action

This example provides a side-by-side comparison of how @ic-reactor/codegen is used by both the CLI and the Vite plugin to generate consistent, type-safe hooks.

  • Shared Core: Understand how both tools use the same underlying codegen logic.
  • Consistent Output: Verify that hooks generated via CLI match those from the Vite plugin.
  • Flexibility: See how to use codegen utilities in custom build scripts.
  • Project Structure: Best practices for organizing generated declarations.

The example contains two sub-projects: one using the Vite plugin and one using the CLI. Both target the same canister and produce identical hook interfaces, demonstrating the reliability of the shared codegen.

Feature Vite Plugin CLI
Automation Fully automatic Manual/Scripted
HMR Built-in Requires rebuild
Integration Vite projects Any frontend / Node.js
Configuration vite.config.ts ic-reactor.json