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
Bundled SSR builds never link @angular/platform-server (optimizeDeps.exclude skip also applies in builds) → JIT compiler unavailable #695
Found while reviewing #685. Older than it (same on b365c0b).
The main plugin adds optimizeDeps.exclude: ['@angular/platform-server'] (vite-plugin/index.ts ~806). The linker's transform (angular-linker-plugin.ts ~214) returns early for every id that optimizeDeps.exclude matches. That skip came with #211 (for #210, a dev-server case), but transform also runs in builds. So when a server build bundles Angular, @angular/platform-server is never linked:
vite build --app (or --ssr) with ssr.noExternal: true, no `import '@angular/compiler'`
dist/ssr/server.js still has static ɵfac = ɵɵngDeclareFactory({...}) (PlatformState, … — 24 left)
import + renderApplication → Error: JIT compiler unavailable (getCompilerFacade ← ɵɵngDeclareFactory)
same build, with optimizeDeps.exclude emptied in configResolved → 0 ɵɵngDeclare left, renders fine
linkAngularPackageSync on _server-chunk.mjs directly → linked, 0 left
Checked with Vite 8.3.4 and Angular 22.2.5. It only works today if the app imports @angular/compiler (the JIT facade).
Possible direction: apply the optimizeDeps.exclude skip only on the dep optimizer path (the dev case #210 needed), not in the build transform, or keep @angular/platform-server out of the linker's skip list. Re-check #210's repro with any fix.
Activity
fix: align host bindings, .d.ts injection and SSR/linker with ngtsc (v…