You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removing the keyword new fixes the problem. Additionally, the function could get imported with the original name (initial lowercase) to avoid confusions too.
I don't know why this utility was being used that way. I checked the module history back to it's origin at 2015 and was a normal function (not a constructor), but maybe that came from a refactor at another module implemented differently; anyway, it's a long way is not a constructor so I think the proposed change should be compatible with any recent and supported cordova/cordova-android version, or Am I missing something?
Expected Behaviour
Compile without errors
Actual Behaviour
Doesn't compile
Reproduce Scenario (including but not limited to)
Modern Cordova app.
Steps to Reproduce
Create Cordova APP, add plugin, compile.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Internally, uses cordova-common version 4.1.0. Per their commit log, a refactor on that module causes that the function cannot be call as a constructor (using method notation on a plain object rather than assigning a function as property). Per the implementation of that function, now and on previous versions, is not needed at all call it as a constructor (I don't know it that's was different at some point in the past).
NodeJS v14.17.0 (the V8 engine is responsible for limiting the way the function is executed, so the source error message comes from it).
Bug Report
Error at compilation because
ParseElementtreeSync is not a constructor
.That function is an alias for the utility
parseElementtreeSync
fromcordova-common//src/util/xml-helpers
.Is called as a constructor here.
Proposed solution
Removing the keyword
new
fixes the problem. Additionally, the function could get imported with the original name (initial lowercase) to avoid confusions too.I don't know why this utility was being used that way. I checked the module history back to it's origin at 2015 and was a normal function (not a constructor), but maybe that came from a refactor at another module implemented differently; anyway, it's a long way is not a constructor so I think the proposed change should be compatible with any recent and supported cordova/cordova-android version, or Am I missing something?
Expected Behaviour
Compile without errors
Actual Behaviour
Doesn't compile
Reproduce Scenario (including but not limited to)
Modern Cordova app.
Steps to Reproduce
Create Cordova APP, add plugin, compile.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Tarket SDK 31 / Android 12.
And for Cordova
Internally, uses
cordova-common
version 4.1.0. Per their commit log, a refactor on that module causes that the function cannot be call as a constructor (using method notation on a plain object rather than assigning a function as property). Per the implementation of that function, now and on previous versions, is not needed at all call it as a constructor (I don't know it that's was different at some point in the past).NodeJS v14.17.0 (the V8 engine is responsible for limiting the way the function is executed, so the source error message comes from it).
(Android) Device Vendor (e.g. Samsung, HTC, Sony...)
N/A
cordova info
PrintoutThe text was updated successfully, but these errors were encountered: