Skip to content

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.

FeatureVite PluginCLI
AutomationFully automaticManual/Scripted
HMRBuilt-inRequires rebuild
IntegrationVite projectsAny frontend / Node.js
Configurationvite.config.tsic-reactor.json