the require and exec functions are methods of the cordova object. When you install a plugin it gets wrapped in function that give access to the cordova object. Those calls are actually cordova.require and cordova.exec
Here is an example of a plugin js file before and after install:
BEFORE:
var exec = require("cordova/exec");
var VideoPlayer = {
play: function(url) {
exec(null, null, "VideoPlayer", "playVideo", [url]);
}
};
module.exports = VideoPlayer;
AFTER:
cordova.define("com.dawsonloudon.videoplayer.VideoPlayer", function(require, exports, module) {
var exec = require("cordova/exec");
var VideoPlayer = {
play: function(url) {
exec(null, null, "VideoPlayer", "playVideo", [url]);
}
};
module.exports = VideoPlayer;
});
Additionally, to answer about the config setup, the clobbers command secures the name space of your plugin object. From my plugin:
<js-module src="www/VideoPlayer.js" name="VideoPlayer">
<clobbers target="VideoPlayer" />
</js-module>
This is stating the name of my JS file, and the object namespace used to call to my plugin in JS.