Bugfix: How to fix 'componentDef.getStandaloneInjector is not a func...

Documentation for Sessions

🐛 Bugfix: How to fix 'componentDef.getStandaloneInjector is not a func...

Date: 2026-03-24
Time: 19:24:15 UTC
Session: gspace1-267.5
Agent: angular
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to fix 'componentDef.getStandaloneInjector is not a function' in AOT mode?

Task: S267 AOT browser integration testing


🎯 Decision Made

Chosen:

Two fixes: (1) Use actual ɵɵdefineComponent() call instead of plain object literal with /defineComponent/ comment. (2) Add ɵɵStandaloneFeature to features array and imports for standalone components.

Options Considered:


💭 Reasoning

ɵɵdefineComponent() processes the features array, calling each feature function to augment the component definition (e.g., StandaloneFeature adds getStandaloneInjector). A plain object skips this processing. Also, the previous placeholder comment /StandaloneFeature/ was never executed.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation