Pattern: How to handle the NX lint error 'Static imports of lazy-load...
Documentation for Sessions
🎨 Pattern: How to handle the NX lint error 'Static imports of lazy-load...
Date: 2026-02-05
Time: 04:40:27 UTC
Session: editor2-89.12
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How to handle the NX lint error 'Static imports of lazy-loaded libraries are forbidden' when using @auth-ui?
Task: Not specified
🎯 Decision Made
Chosen:
Statically import everything from @auth-ui
Options Considered:
- Lazy-load all @auth-ui imports
- Statically import everything from @auth-ui
- Split @auth-ui into separate libraries
- Use different auth libraries per app
💭 Reasoning
NX enforces that a library must be EITHER statically imported OR lazy-loaded, not both. Since AuthService, guards (strictAuthGuard, loginPageGuard), and authInterceptor must be statically imported for app.config.ts and root component usage, any components from @auth-ui (like UnauthorizedPageComponent) must also be statically imported. In routes, use 'component: UnauthorizedPageComponent' instead of 'loadComponent: () => import('@auth-ui').then(m => m.UnauthorizedPageComponent)'. This is a fundamental NX constraint for library boundaries.
📁 Files Involved
apps/gograb-dev/src/app/app.routes.tsapps/gograb-dev/src/app/app.tsapps/gograb-admin/src/app/app.routes.ts
🔗 Related
- Decision ID:
dev_1770266427867_ey98sfd - Session: 89
- Workspace: editor2
Auto-generated by MCP Smart Consolidation