Skip to content

Bundled SSR builds never link @angular/platform-server (optimizeDeps.exclude skip also applies in builds) → JIT compiler unavailable #695

Closed

Description

@Brooooooklyn

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

  1. added a commit that references this issue on Nov 11, 2026
    aff917b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions