angular / angular/angular-cli

feat: add option to disable route extraction feature

オープン
#31,340 コメント 14 件 リアクション 5 件 担当者 0 名 GitHub で見る
area: @angular/ssr feature feature: insufficient votes
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### Command

build

### Description

When migrating apps to SSR, route extraction basically gets in the way and makes it harder to understand where the issue/error is coming from, as it tries to run before everything else either during build or server.

Instead of fixing other SSR related errors, I have to go and fix route extraction issues.

Also, there is no way to know if route extraction is happening. But even if it was possible the code would be full of checks on what mode is Angular running, and having to deal with all the states instead of just handling a normal case of -> open the url -> render angular -> serve html.

### Describe the solution you'd like

Add a flag to disable route extraction during build or serve totally, at least just for development purposes.
When routes are dynamically loaded based on config, having the extraction happen before the config can be loaded breaks the dynamic apps. If I build my app with a config that has 3 routes, and then on runtime I want to use another config.json file to load other routes (that also include the first three but with different configs), would cause my app to misbehave because of the initial extracted routes.

---

`NG_BUILD_PARTIAL_SSR=1` partially solves this by skipping the route extraction and doing it initial request.

### Repo
Comment out line 9 to better understand that serving or building the app is painful, even though on normal conditions opening localhost:4200/config.json loads fine.

https://github.com/eneajaho/dx-issue/blob/main/src/main.server.ts#L9

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず build コマンドと既存の NG_BUILD_PARTIAL_SSR=1 の動作を確認し、次にリンク先のサンプルリポジトリで src/main.server.ts の 9 行目を使って問題を再現します。build または serve 中のルート抽出を flag で無効にでき、動的に読み込まれるルートを持つアプリケーションが引き続き動作すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
build-system, web-dev
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。