Architecture: How to handle Angular templateUrl/styleUrl in in-browser JIT...
Documentation for Sessions
🏗️ Architecture: How to handle Angular templateUrl/styleUrl in in-browser JIT...
Date: 2026-03-15
Time: 18:08:02 UTC
Session: gspace1-224.7
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How to handle Angular templateUrl/styleUrl in in-browser JIT preview?
Task: Fix Angular component resource resolution in preview
🎯 Decision Made
Chosen:
Pre-process VFS files to inline templateUrl→template and styleUrl→styles before rspack compilation. Regex-based resolution against the VFS file map.
Options Considered:
- Inline at VFS level before rspack
- Configure rspack to resolve templateUrl
- Add custom rspack loader
- Serve individual files via SW and let JIT fetch them
💭 Reasoning
Angular JIT in a Service Worker context cannot resolve relative file URLs (no HTTP server to fetch ./foo.component.html). This mimics what @ngtools/webpack does at build time. The inlining happens in enrichFileMap before rspack sees the files, so the compiled output has inline template/styles that JIT can process.
📁 Files Involved
libs/libs-structural/platform-preview/src/lib/services/bundler-filesystem.service.ts
🔗 Related
- Decision ID:
dev_1773598082029_avy2vat - Session: 224
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation