Angular 19 SSR cloud functions ESM build
- Lingua principale
- TypeScript
- Stelle
- 7.8k
- Fork
- 2.2k
- Merge medio
- 22h 28m
- PR unite (30g)
- 6
Descrizione
- [ ] unable to serve/deploy ssr functions esm build artifacts with vanilla cloud functions
- [x] able to ng serve, ng build (build-angular:application), and node ./server.mjs
- [x] other functions unrelated to SSR are working (server backend) as intended
Heres my SSR setup:
universal.ts
```typescript
import { onRequest } from 'firebase-functions/v2/https';
import { render } from '../../render.js';
import express, { Request, Response, NextFunction } from 'express';
import * as server from '../../../dist/stamp-app/server/server.mjs';
export const ssrApp = express() as any;
ssrApp.use(express.static('dist/stamp-app/browser'));
ssrApp.get('*', async (req: Request, res: Response, next: NextFunction) => {
const ssr: any = await render(server, req, res, next);
res.send(ssr);
});
export const universal = onRequest(
{ maxInstances: 10, timeoutSeconds: 1200, cpu: 1, memory: '2GiB', region: ['us-central1'] },
ssrApp
);
```
render.js
```typescript
import { Request, Response, NextFunction } from "express";
export async function configServerApp(app: any, req: Request, res: Response, next: NextFunction) {
//configure app here & retrieve HTML
let template;
if (req.path === '/') {
// template = await fetch('@dist/stamp-app/browser/index.csr.html');
next();
}
template = `
return template;
}
export async function render(app: any, req: Request, res: Response, next: NextFunction) {
const ssrApp = await configServerApp(app, req, res, next);
return ssrApp;
}
```
am I missing something..? thanks for any help in advance
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con universal.ts e render.js, quindi riproduci la differenza segnalata tra ng build (build-angular:application), node ./server.mjs e il deployment delle funzioni SSR. Esamina il dist/stamp-app/server/server.mjs generato e gli artefatti del browser insieme alla configurazione vanilla di Cloud Functions. Il lavoro è completato quando la funzione SSR gestisce le richieste e viene sottoposta correttamente al deployment con la build ESM.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, express, firebase, node.js, typescript
- Ambito
- backend, cloud
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 43/100