Esbuild Web Worker Type Safety and Redundant tsconfig.worker.json
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 162
描述
### Command
build
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
When using esbuild as the bundler for Angular projects, the support for web workers appears misleading in terms of type safety:
- In the previous webpack-based build setup, web workers had proper TypeScript type checking at build time.
- Currently, esbuild does not type-check web workers during build time. This is not documented or clearly communicated, leading to a false sense of correctness.
- Additionally, creating a project with a web worker generates a `tsconfig.worker.json`, which seems redundant because esbuild doesn't use it for type-checking. Also `builder` contains the `webWorkerTsConfig` option in the schema, as I understand it, this doesn't affect anything. This can confuse developers into thinking their web worker code is properly validated.
**Expected Behavior**
Either esbuild-based builder should perform type checking on web worker files, or there should be clear documentation and/or warnings that type-checking is not performed on workers.
**Current Behavior**
- No build-time type checking for worker code.
- Misleading tsconfig.worker.json is generated, giving false confidence in type safety.
### Minimal Reproduction
1. Generate a new Angular project with esbuild (Angular CLI 18+).
2. Add a web worker via ng generate web-worker.
3. Introduce a type error in the worker file.
4. Run ng build – no type error is reported.
### Exception or Error
```text
```
### Your Environment
```text
Any version with esbuild bundler.
```
### Anything else relevant?
_No response_
貢獻指南
研究方向
首先重現所描述的 Angular CLI esbuild 工作流程:產生一個 web worker,加入型別錯誤,然後執行 ng build。檢查產生的 tsconfig.worker.json,以及 builder schema 中的 webWorkerTsConfig 選項。當 worker 的型別檢查行為獲得修正或清楚記錄,且誤導性的設定已獲處理時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, typescript
- 領域
- build-system, cli
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100