Cordova hook to add plugins as link.
Apply cordova-hook-link-plugins.
$ npm install cordova-hook-link-plugins
<!-- config.xml -->
<hook src="./node_modules/cordova-hook-link-plugins/index.js" type="before_platform_add" />
Manage cordova plugins using npm (with package.json and npm-shrinkwrap.json) in the same way as any other module.
// package.json
"dependencies": {
"cordova-plugin-device": "0.2.1"
}
$ npm install
In config.xml
, put the installed path into plugin spec.
<!-- config.xml -->
<plugin name="org.apache.cordova.core.device" spec="./node_modules/cordova-plugin-device" />
Once before_platform_add
runs, there are symbolic links in the plugins folder.
$ cordova platform add browser
$ ls ./plugins/
org.apache.cordova.core.device -> ../node_modules/cordova-plugin-device/