breautek commented on issue #1009: URL: https://github.com/apache/cordova-android/issues/1009#issuecomment-653838970
Cordova doesn't support support ES modules as it is still an experimental technology in node js (which means there are likely to be bugs and drastic changes in the API/behaviour) In fact the error message seems to indicate this is a bug in NodeJS because `node_modules\cordova-lib\src\cordova\util.js` nearest `package.json` file is `node_modules/cordova-lib/package.json`, and it does not have `"type": "module"` in it, therefore I don't think it's suppose to be treated as an ES file. Nor should it be treated as an ES file because none of cordova sources are not ES modules, they are traditional node modules. As a workaround I'd probably use another tool that transpiles your code into commonjs so that it can be ran in NodeJS for your unit testing. A popular tool for this kind of thing is Babel, and I believe it has the capability of transpiling ES modules into commonjs. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
