angular / angular/angular-cli

File replacements are ignored for web workers

オープン
#29,546 コメント 8 件 リアクション 8 件 担当者 0 名 GitHub で見る
angular/build:application area: @angular/build freq1: low severity3: broken type: bug/fix
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### Command

build, serve

### Is this a regression?

- [x] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

v18

### Description

Hi, we recently updated to angular v19. During that we also migrated the builder to the recommended `@angular/build` builder, but in my tests the error also occured for the old devkit builder. After the update, we noticed that file replacements are ignored for web workers, see minimal reproduction. Before our upgrade, this was working without problems. I'm happy about any help :)

### Minimal Reproduction

StackBlitz: https://stackblitz.com/edit/4gqtqodb

After everything was built, you will see in the console:
```
Component: production
Worker: development
```

However, as defined in the `angular.json`, the file `env.ts` should be replaced by `env.prod.ts`, which is done correctly in the component.

### Exception or Error

```text

```

### Your Environment

```text
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/

Angular CLI: 19.0.7
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

Angular: 19.0.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser

Package Version
------------------------------------------------------
@angular-devkit/architect 0.1900.7
@angular-devkit/core 19.0.7
@angular-devkit/schematics 19.0.7
@angular/build 19.0.7
@angular/cdk 19.0.5
@angular/cli 19.0.7
@angular/material 19.0.5
@schematics/angular 19.0.7
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
```

### Anything else relevant?

Seems to happen for both build and serve, local and on stackblitz and for both the devkit and the new builder.

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

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

調査の方向性

リンクされている StackBlitz の再現環境とその angular.json から始め、build と serve の両方について、ファイル置換がコンポーネントと web worker にどのように適用されるかを比較します。設定された置換により、コンポーネントだけでなく worker も env.prod.ts を使用し、どちらの builder を使っても動作すれば完了です。

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

評価

技術スタック
angular, typescript
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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