File replacements are ignored for web workers

未关闭
#29,546 8 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
build-system

调研方向

从链接的 StackBlitz 复现和其中的 angular.json 开始,然后比较在 build 和 serve 中,文件替换如何应用于组件和 web worker。完成标准是:在已配置的替换下,worker 与组件一样使用 env.prod.ts,并且使用任一 builder 都能实现。

由索引模型根据 Issue 内容生成。

描述

angular/build:application area: @angular/build freq1: low severity3: broken type: bug/fix
Command

build, serve

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

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

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

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.

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
16 小时 35 分钟
30 天内合并 PR
176

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。