@@ -54,6 +54,10 @@ const getPrerenderedRoutes = async (outputDir) => {
5454 const file = join ( outputDir , 'prerendered-routes.json' )
5555 if ( ! existsSync ( file ) ) return [ ]
5656 const { routes : prerenderedRoutes } = await readJson ( file )
57+
58+ // angular@19 returns an object with routes as keys
59+ if ( ! Array . isArray ( prerenderedRoutes ) ) return Object . keys ( prerenderedRoutes )
60+
5761 return prerenderedRoutes
5862}
5963
@@ -103,22 +107,15 @@ const setUpEdgeFunction = async ({ angularJson, constants, failBuild }) => {
103107
104108 const ssrFunction = `
105109 import "./polyfill.mjs";
106- import { Buffer } from "node:buffer";
107- import { renderApplication } from " ${ toPosix ( relative ( edgeFunctionDir , serverDistRoot ) ) } /render-utils.server.mjs";
108- import bootstrap from " ${ toPosix ( relative ( edgeFunctionDir , serverDistRoot ) ) } /main.server.mjs";
110+ import { ɵgetOrCreateAngularServerApp as getOrCreateAngularServerApp } from "${ toPosix (
111+ relative ( edgeFunctionDir , serverDistRoot ) ,
112+ ) } /main.server.mjs";
109113 import "./fixup-event.mjs";
110114
111- const document = Buffer.from(${ JSON . stringify (
112- Buffer . from ( html , 'utf-8' ) . toString ( 'base64' ) ,
113- ) } , 'base64').toString("utf-8");
115+ const app = getOrCreateAngularServerApp()
114116
115117 export default async (request, context) => {
116- const html = await renderApplication(bootstrap, {
117- url: request.url,
118- document,
119- platformProviders: [{ provide: "netlify.request", useValue: request }, { provide: "netlify.context", useValue: context }],
120- });
121- return new Response(html, { headers: { "content-type": "text/html" } });
118+ return await app.render(request, context)
122119 };
123120
124121 export const config = {
0 commit comments