Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions packages/angular/ssr/src/app-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,17 @@ export class AngularAppEngine {
return null;
}

const { ɵgetOrCreateAngularServerApp } = entryPoint;
if (!ɵgetOrCreateAngularServerApp) {
// Sometimes in Vite `ɵgetOrCreateAngularServerApp` is undefined,
// which causes a runtime error `Error: ɵgetOrCreateAngularServerApp is not a function`
// See: https://github.com/angular/angular-cli/issues/31671
return null;
}

// Note: Using `instanceof` is not feasible here because `AngularServerApp` will
// be located in separate bundles, making `instanceof` checks unreliable.
const ɵgetOrCreateAngularServerApp =
entryPoint.ɵgetOrCreateAngularServerApp as typeof getOrCreateAngularServerApp;

const serverApp = ɵgetOrCreateAngularServerApp({
const serverApp = (ɵgetOrCreateAngularServerApp as typeof getOrCreateAngularServerApp)({
allowStaticRouteRender: AngularAppEngine.ɵallowStaticRouteRender,
hooks: AngularAppEngine.ɵhooks,
});
Expand Down