feat: add option to disable route extraction feature
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 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 行重現該問題。當一個 flag 可以在 build 或 serve 期間停用路由擷取,同時具有動態載入路由的應用程式仍能繼續運作時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, typescript
- 領域
- build-system, web-dev
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100