daniel-sc / ng-extract-i18n-merge

Extract and merge i18n xliff translation files for angular projects.
MIT License
170 stars 18 forks source link

Error: xmldoc_1.XmlTextNode is not a constructor due to xmldoc version conflict in ng-extract-i18n-merge #108

Closed jagipas closed 5 months ago

jagipas commented 5 months ago

Describe the bug When using the ng-extract-i18n-merge library, which lists xmldoc as a dependency, executing the command extract-i18n triggers the error: An unhandled exception occurred: xmldoc_1.XmlTextNode is not a constructor. Upon investigation, it appears that the imports used in the translationFileSerialization file of the xmldoc library are not available until version 1.1.3 of xmldoc. However, in ng-extract-i18n-merge, the version is defined as "xmldoc": "^1.1.2", leading to potential conflicts in environments where xmldoc is also used by another package, possibly causing the installation of version 1.1.2, which then results in the aforementioned error.

Setup/Configuration Angular 17 project with other package that uses xmldoc (in my case compodoc)

Expected behavior The extract-i18n command should successfully extract translations without throwing any errors related to xmldoc.

Screenshots

Version (please complete the following information):

Additional context It seems that the issue could be resolved by updating the xmldoc dependency version to ^1.1.3 or later, ensuring that the necessary imports for translationFileSerialization are available. This would prevent conflicts in environments where an older version of xmldoc could be inadvertently installed due to the current version range specification.

daniel-sc commented 5 months ago

@jagipas thanks for the report and the detailed research! I'll fix this asap..