angular / angular/angular-cli

CLI doesn't allow custom builder to pass additional extensions when building app for i18n extractions

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

説明

### Command

extract-i18n

### Description

We're in the process of migrating from webpack to esbuild.
To provide custom esbuild plugins we decided to use custom builder (https://github.com/just-jeb/angular-builders).

It went smooth until we realised that `extract-i18` no longer works. It ends successfully but `messages.xlf` is empty.

It turned out that angular checks `builderName` to choose which bundler to use.

To fix that I decided to implement custom `extract-i18n` builder that will trick `angular/cli` and force using esbuild -
https://github.com/just-jeb/angular-builders/pull/1711

For the record `nrwl/nx` did the same - https://github.com/nrwl/nx/pull/21802

**The issue** is that `angular/cli` will not let us pass any extensions during i18n application compilation.

https://github.com/angular/angular-cli/blob/1034bb155b58a5f18eecf56409a3ff99d2ca4474/packages/angular_devkit/build_angular/src/builders/extract-i18n/application-extraction.ts#L59

It may lead to inconsistency between build and extract flow, which I suppose may lead to issues with i18n.

### Describe the solution you'd like

We should be able to pass custom extensions as for regular app building.

(bonus) would be really nice if these `if (builderName === ...` are replaced by something that is custom builder friendly 🙏

### Describe alternatives you've considered

Alternatively we could rewrite whole `extract-i18n` builder, but as 95% of the code would be the same - it seems pointless

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

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

調査の方向性

Start in packages/angular_devkit/build_angular/src/builders/extract-i18n/application-extraction.ts at the linked line and compare how regular application builds receive extensions. Verify that extract-i18n passes custom builder extensions during application compilation and that messages.xlf contains the extracted messages rather than being empty.

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

評価

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

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

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