daniel-sc/ng-extract-i18n-merge

v2 breaks custom-webpack usage

ben-muc opened this issue · 4 comments

Describe the bug
In V1 we ware able to define

        "extract-i18n": {
          "builder": "@angular-builders/custom-webpack:extract-i18n",

to have the library use the custom webpack configuration under the hood.
After ugrading to v2 this fails as

"extract-i18n": { "builder": "ng-extract-i18n-merge:ng-extract-i18n-merge",
completely replaces the old target making it impossible to use the custom webpack builder with i18n-merge.

Therefore with v2 I'm getting "./src/locale/messages.de.xlf:1:0 - Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. " as I need it to use a custom loader defined in custom-webpack.config.js

Expected behavior
A documented way to use the old target which is then using the extract-i18n target which can be customized or a way to make the existing v2 extract-i18n target use the @angular-builders/custom-webpack:extract-i18n.

Version (please complete the following information):

  • Angular: 13.3.9
  • OS: Win10
  • nodejs: 14.16.0
  • ng-extract-i18n-merge version: from 1.4.0 to 2.4.0

Hi @ben-muc
Thanks for reporting this.
Does the custom builder need special options/inputs or would it suffice to make the builder name configurable?
See https://github.com/daniel-sc/ng-extract-i18n-merge/blob/v2.4.0/src/builder.ts#L83

It doesn't need any special options. Making the builder name configurable should be sufficient.

@ben-muc could you try if the prerlease 2.5.0-0 would work for you (with configuring "builderI18n": "@angular-builders/custom-webpack:extract-i18n")?

Yes, thank you for the quick action. This makes it work again like with v1.