Open kamilchlebek opened 8 months ago
This is definitely something we can evaluate for inclusion.
Would it be possible to provide some additional information in what is being customized for the build process with the builder?
Sure, we use both middlewares and plugins.
Middlewares are used mainly for proxy configuration (and serving different themes for development purposes, there's an issue related to that, see: https://github.com/angular/angular-cli/issues/27110)
Plugins in general use options.define
to pass some additional context to your apps, as: version, build id, supported browsers (browserlist regex), list of supported locales (extracted from angular.json
).
I think once angular allows passing custom middlewares/plugins directly to default builders from @angular-devkit/build-angular
the main issue becomes obsolete. It seems it's almost done, but not exposed to @angular-devkit/build-angular
public API.
Any update on this issue?
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 butmessages.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 trickangular/cli
and force using esbuild - https://github.com/just-jeb/angular-builders/pull/1711For the record
nrwl/nx
did the same - https://github.com/nrwl/nx/pull/21802The 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