Esbuild Web Worker Type Safety and Redundant tsconfig.worker.json
- Ngôn ngữ chính
- TypeScript
- Star
- 27k
- Fork
- 11.8k
- Merge trung bình
- 14 giờ 23 phút
- Pull request đã merge (30 ngày)
- 162
Mô tả
### 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_
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện workflow Angular CLI esbuild được mô tả: tạo một web worker, thêm một lỗi kiểu và chạy ng build. Kiểm tra tsconfig.worker.json được tạo và tùy chọn webWorkerTsConfig trong schema của builder. Công việc được xem là hoàn tất khi hành vi kiểm tra kiểu của worker được sửa hoặc được ghi chép rõ ràng, đồng thời cấu hình gây hiểu nhầm được xử lý.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- build-system, cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100