Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(custom-esbuild): add extract-i18n builder #1711

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kamilchlebek
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

We successfully switched from using webpack to esbuild thanks to @angular-builders/custom-esbuild:application.

However once we tried to extract i18n messages our xlf file had 0 items inside.

It turned out that angular checks builder name to decide whether to use webpack/esbuild strategy - https://github.com/angular/angular-cli/blob/c2b8d84e360f0508e73f7c502516f898f067c03b/packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts#L64-L65

What is the new behavior?

Proposed @angular-builders/custom-esbuild:extract-i18n builder temporarily overrides builder name, strips unsupported configuration options and then runs default @angular-devkit/build-angular:extract-i18n builder.

For the reference, nx is doing the same: nrwl/nx#21802

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@just-jeb
Copy link
Owner

Hey, thanks for submitting the PR! One question - wouldn't removing plugins mean that the build flow and the extract flow might be different and therefore the extraction might not work as expected?

@kamilchlebek
Copy link
Contributor Author

That's very good question! I'll dig deeper to find out if this may or may not be the issue.

@kamilchlebek
Copy link
Contributor Author

kamilchlebek commented Mar 12, 2024

@just-jeb

Here are my latest findings.
Unfortunately without help from angular team I can't do more (angular/angular-cli#27264).

Currently there's no way to have exactly the same build & extract flow - angular will not pass any extensions when executing i18n builder:

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

@just-jeb
Copy link
Owner

@kamilchlebek thanks for the update. Seems like we're blocked here until Angular CLI implement your request. Probably submitting a PR could speed it up.

Side note: they won't expose the plugins functionality directly from Angular CLI builders, this has been their official policy and that's the reason custom builders exist 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants