Currently working on implementing a Cordova plugin called core-cordova
found in this repository. This particular plugin has a dependency on another NPM package.
The issue arises after installing the plugin in my app using:
$ cordova plugin add @aerogearservices/core-cordova
Upon installation, I encountered this error in the console:
Uncaught module @aerogearservices/core not found
I believe that I need to somehow bundle this dependency into the plugin's JS files. I attempted to use Browserify
to consolidate everything into a single file named dist/core-cordova.js
and referenced it in the Plugin.xml
as follows:
<js-module src="dist/core-cordova.js" name="MetricsService">
<clobbers target="cordova.aerogear" />
</js-module>
Although this method did not generate any errors, the aerogear
object remained empty when accessed:
// Browser's dev console
> window.cordova.aerogear;
-> {}
> window.cordova.aerogear.MetricsService;
-> undefined
This dilemma has left me puzzled. Any suggestions on how to resolve this?
NOTE: The source code is a work in progress and may undergo changes or contain errors.