Architecture: What compilation strategy for in-browser Angular preview han...

Documentation for Sessions

🏗️ Architecture: What compilation strategy for in-browser Angular preview han...

Date: 2026-03-15
Time: 23:13:47 UTC
Session: gspace1-224.7
Agent: angular
Confidence: 85%
Status: ✅ Documented


📋 Decision Context

Question:

What compilation strategy for in-browser Angular preview handles JIT deprecation?

Task: Plan Angular JIT deprecation migration for Live Preview


🎯 Decision Made

Chosen:

Hybrid approach: Use JIT now with @angular/compiler CDN import (working, validated). Plan migration path to pre-compiled Ivy instructions via Angular Linker or custom SWC plugin as a build-time step before rspack, removing @angular/compiler runtime dependency. JIT removal is expected Angular 22-23 (2026-2027), giving 1-2 years to migrate.

Options Considered:

  1. Keep JIT forever (deprecated, will break)
  2. Pre-compile with Angular Linker now (complex, premature)
  3. Hybrid: JIT now, Linker migration planned (chosen)
  4. Replace Angular with React/Preact (not framework-native)

💭 Reasoning

Angular JIT works today (confirmed: component renders with template bindings, decorators processed by SWC into __decorate calls, @angular/compiler resolves at runtime from esm.sh CDN). Angular's deprecation timeline is gradual — JIT still works in Angular 20.3.18. The migration path is: (1) Currently: SWC transpiles TS→JS with decorator metadata, Angular JIT processes decorators at runtime. (2) Future: Add Angular Linker (babel plugin @angular/compiler-cli/linker) or SWC equivalent as a pre-processing step in the rspack worker. This converts partial compilation output to full Ivy instructions, eliminating @angular/compiler runtime dependency. (3) The generated platform code already uses standalone components with inline templates (after our inlining step), which is the modern Angular pattern. Key insight: the rspack worker architecture makes this migration clean — just add a pre-processing step in the worker before rspack compilation.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation