File replacements are ignored for web workers

Ouverte
#29,546 8 commentaires 8 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
angular, typescript
Domaine
build-system

Piste de recherche

Commencez par la reproduction StackBlitz liée et son angular.json, puis comparez la manière dont les remplacements de fichiers sont appliqués au composant et au web worker, pour build comme pour serve. Le travail est terminé lorsque le worker utilise env.prod.ts, tout comme le composant, avec le remplacement configuré, en utilisant l’un ou l’autre builder.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
16 h 35 min
PR mergées (30 j)
176

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de angular/angular-cli

Toutes les issues de angular/angular-cli

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.