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.
Features Demonstrated
Section titled “Features Demonstrated”- 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.
Open in StackBlitz Edit and run in your browser
View on GitHub Browse the source code
Live Preview
Section titled “Live Preview”Implementation
Section titled “Implementation”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.
CLI vs Vite Plugin
Section titled “CLI vs Vite Plugin”| 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 |