You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shims #61
This is a separate issue from the SSR app-engine-manifest topic.
With Angular SSR + OXC build lane, we observed multiple runtime parity regressions that required patching Angular internals/app runtime behavior to avoid SSR crashes.
Environment
OS: macOS 15.7.4 (Darwin 24.6.0)
Arch: x86_64 (darwin-x64)
Node: v22.20.0
npm: 10.9.3
Versions
@angular/core: ^21.2.0
@angular/ssr: ^21.2.0
@angular/cli: ^21.2.0
@angular-devkit/build-angular: ^21.2.0
@oxc-angular/vite: ^0.0.7
vite: ^8.0.0-beta.16
typescript: ~5.9
Repro shape (project-level)
Build OXC SSR:
npm run build:oxc:ssr
Start SSR server:
bash
PORT=4211 HOST=127.0.0.1 node dist/portal-oxc/server/server.mjs
Hit SSR routes (example):
bash
NG0201 related to NgControl during SSR route rendering.
NgControlStatus could be instantiated before a matching NgControl provider is available.
Reactive forms setup timing
FormControlName path could run before parent form directive is fully wired.
Runtime failure around parent formDirective / addControl availability.
Router query metadata
RouterLinkActive content query metadata appeared missing in SSR bundle path.
links was undefined during ngAfterContentInit, causing runtime failure.
Apollo generated services DI
Constructor DI metadata for generated Apollo services was not reliable in OXC SSR lane.
We had to force @Inject(Apollo.Apollo) on generated constructors to avoid DI/runtime breakage.
What we tried / current workaround
To keep OXC SSR route rendering stable, we added temporary patches:
RouterLinkActive shim:
In ngAfterContentInit, if links is undefined, initialize it with new QueryList().
NgControlStatus shim:
Patched ɵfac to inject NgControl with optional/self flags to avoid hard SSR crash.
FormControlName shim:
Guarded _setUpControl to return early if formDirective or addControl is not ready.
Apollo codegen patch:
Post-codegen script adds @Inject(Apollo.Apollo) to generated service constructors.
After these workarounds, SSR smoke is stable in our OXC lane.
Expected behavior
OXC SSR output should preserve Angular runtime parity so that:
RouterLinkActive content query behavior matches baseline.
Forms DI/setup order does not require patching internals.
Generated Apollo services do not need post-processing for DI compatibility.
Why this matters
Current behavior requires monkey-patching framework internals and generated code, which is fragile for upgrades and not production-safe long-term.
Hi! Thanks for sharing the @Inject workaround. I tried the Apollo case with a service generated by GraphQL Code Generator and kept its constructor(apollo: Apollo.Apollo) as generated.
On @oxc-angular/vite@0.0.7, I could reproduce NG0202 during SSR. The generated factory calls ɵɵinvalidFactoryDep(0).
On 0.0.45, the same service received the value I provided for Apollo and the component rendered successfully. Angular’s ngc gave the same result. I used Angular 21.2.1 for both Oxc runs and the ngc check.
This matches the fix in #634, which shipped in 0.0.43. If you still have that codegen patch in place, could you try 0.0.45 without it and see if the Apollo service works in your app too?
Activity
nagahara-naoki commentedon Nov 20, 2026
Hi! Thanks for sharing the
@Injectworkaround. I tried the Apollo case with a service generated by GraphQL Code Generator and kept itsconstructor(apollo: Apollo.Apollo)as generated.@oxc-angular/vite@0.0.7, I could reproduceNG0202during SSR. The generated factory callsɵɵinvalidFactoryDep(0).0.0.45, the same service received the value I provided forApolloand the component rendered successfully. Angular’sngcgave the same result. I used Angular 21.2.1 for both Oxc runs and thengccheck.This matches the fix in #634, which shipped in
0.0.43. If you still have that codegen patch in place, could you try0.0.45without it and see if the Apollo service works in your app too?