angular / angular/angular-cli

Esbuild Web Worker Type Safety and Redundant tsconfig.worker.json

Aperta
#30,676 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
angular/build:application area: @angular/build freq1: low severity1: confusing type: bug/fix
Lingua principale
TypeScript
Stelle
27k
Fork
11.8k
Merge medio
14h 23m
PR unite (30g)
162

Descrizione

### 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_

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il workflow Angular CLI esbuild descritto: genera un web worker, aggiungi un errore di tipo ed esegui ng build. Ispeziona il tsconfig.worker.json generato e l’opzione webWorkerTsConfig dello schema del builder. Il lavoro è completo quando il comportamento del controllo dei tipi dei worker è stato corretto o documentato chiaramente e la configurazione fuorviante è stata affrontata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
build-system, cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.