daniel-sc/ng-extract-i18n-merge

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

Closed this issue · 1 comments

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):

  • Angular: 17.3.1
  • nodejs: 18.19.0
  • ng-extract-i18n-merge version: 2.11.1

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.

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