ng serve with traditional backend
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### Which @angular/* package(s) are relevant/related to the feature request?
compiler-cli
### Description
I would like to serve the index.html using a traditional backend, and use ng serve to get HMR for the angular app.
The issue with a proxy for the backend API calls is that development and production behave differently. Also, you cant have additional logic on the backend before serving the index.html (for example cookie auth)
### Proposed solution
Have a flag on `ng serve` that the websocket should go directly to the angular server. and would be nice if we can have a single script instead of having to add it all manually.
In vite all you need to do is add the following to your server's HTML template.
```
```
https://vitejs.dev/guide/backend-integration.html
### Alternatives considered
I tried adding the full path to the angular scripts, but the `/ng-cli-ws` calls goes to the backend server.
```
Angular
```
`--public-host=localhost:4200` fixes the /ng-cli-ws call, but lazy loading and the .hot-update.json still goes the backend server.

changing the base href to `https://localhost:4200/` fixes above, but breaks the routing links
also, you need to enable ssl if your backend is ssl, as it will go to wss instead of ws, i think this should rather be based on options.ssl see https://github.com/angular/angular-cli/issues/24373#issue-1475322626.
コントリビューションガイド
調査の方向性
まず、/ng-cli-ws、遅延読み込みされるアセット、hot-update ファイル、options.ssl の動作に対する ng serve の処理を追跡し、次に既存の public-host フローを確認します。完了の条件は、バックエンドのルーティングやプロトコル選択を壊すことなく、従来型のバックエンド経由で Angular の開発用アセットと websocket を提供できる、サポートされた方法が存在することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- cli
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100