Angular 19 SSR cloud functions ESM build
- 主要語言
- TypeScript
- 星號
- 7.8k
- 分支
- 2.2k
- 平均合併
- 22 小時 28 分鐘
- 30 天內合併 PR
- 6
描述
- [ ] 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
貢獻指南
研究方向
從 universal.ts 和 render.js 開始,然後重現 ng build (build-angular:application)、node ./server.mjs 與 SSR 函式部署之間所回報的差異。檢查產生的 dist/stamp-app/server/server.mjs 和瀏覽器產物,並與原生 Cloud Functions 設定一併比較。使用 ESM 建置時,SSR 函式能成功提供服務並完成部署,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, express, firebase, node.js, typescript
- 領域
- backend, cloud
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 冷清
- 描述清晰度
- 需要釐清
- 新手友好度
- 43/100