we are developing a couple of NPM packages under the same organization:
@aerogearservices/core
@aerogearservices/core-rn
@aerogearservices/core-cordova
Where core-cordova
is a Cordova plugin, installed via dependencies (read more about scoped packages).
Relevant files:
App's package.json
{
...
"dependencies": {
"@aerogearservices/core-cordova": "1.0.0",
...
},
"cordova": {
"plugins": {},
"platforms": ["ios", "android"]
}
}
Plugin's package.json
{
"name": "@aerogearservices/core-cordova",
"version": "1.0.0",
...
"cordova": {
"id": "aerogearservices-core-cordova",
"platforms": [
"android"
]
},
"dependencies": {
"@aerogearservices/core": "1.0.0"
},
"engines": {
"cordovaDependencies": {
...
}
}
}
Plugin's plugin.xml
... ... Apache 2.0
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
...
</config-file>
<source-file
...
/>
</platform>
The plugin really does nothing yet, I am just trying to install it in my app but when I run cordova platform add android
I get this error:
UnhandledPromiseRejectionWarning: CordovaError: Cannot find plugin.xml for plugin "@aerogearservices". Please try adding it again.
The problem is that Cordova installs the plugin under myApp/plugins/aerogearservices/core-cordova
so that it is looking for plugin.xml
at the wrong location.
How do scoped packages and cordova plugins work together? Is there any workaround to this without renaming the plugin?