You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/07/05 06:25:11 UTC

[GitHub] [cordova-android] cagross commented on issue #1009: Cordova build fails if I set 'type: modules' in package.json.

cagross commented on issue #1009:
URL: https://github.com/apache/cordova-android/issues/1009#issuecomment-653848108


   Hey thanks for the reply.  I think the fact that Cordova doesn't support ES modules would explain the behavior I'm experiencing.  But is that stated anywhere in the Cordova documentation?  I looked for it but couldn't see anything about 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)
   
   Didn't Node remove the experimental flag a few releases ago, in Node 13.2.0 ([see here](https://github.com/nodejs/modules/blob/master/doc/archive/plan-for-new-modules-implementation.md))?
   
   > 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.
   
   Yes, thanks for that.  I was going to post back here eventually to say that this is indeed what I did.  I used Browserify (with a Babelify transform) to bundle all the unit testing files in-question into a single JS file.  That allowed me to run that file in Node without issue, and all unit tests were carried out.  This allows me to continue to build my Cordova app.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org