I'm working on a iOS-only project with an embedded Cordova Web view. The Cordova docs say I should use Plugman instead of the Cordova CLI. But why? When I add my platform, Cordova automatically detects and adds plugins. To use Plugman, I would have to remove each plugin and re-add it. And the only difference - that I found - is that Plugman copies the plugins to platforms/ios/cordova/plugins, whereas Cordova keeps them in the plugins directory. And Plugman still copies sources for other platforms! Why use it? The app can load plugins either way, so why prefer Plugman?
2 Answers
It's not preferred, it's the only available tool when using a single-platform workflow. You don't use cordova
(and its platform
, plugin
CLI) at all, only cordova-ios
.
To create an iOS project, run node_modules/cordova-ios/bin/create myproj
.
Then use plugman install --platform ios --project myproj --plugin cordova-plugin-device
. This will copy the plugin's JS interface to the myproj/platform_www. Since you're using your own Xcode project, you won't be using the generated "myproj" project at all - it's just a staging area for the Crodova runtime files. So you need to add the plugins' source files to your project manually, and then copy its platform_www
files to your own www directory, where your embedded Web view can load them.
This should have been covered in more detail in the Cordova guides.

- 2,838
- 2
- 29
- 47
Found this in the latest docs here: https://cordova.apache.org/docs/en/latest/plugin_ref/plugman.html
If you use a cross-platform workflow, you use the cordova CLI utility to add plugins, as described in The Command-Line Interface. The CLI modifies plugins for all specified platforms at once.
If you use a platform-centered workflow, you use a lower-level Plugman command-line interface, separately for each targeted platform.
Early on in my app development (maybe Cordova 3.x or so), I would start working in the individual platforms rather than at the top level -- and then all my changes would be overwritten when I did a cordova build
. Super frustrating -- so I ended up only working at the top level rather than in the /platforms/
directories. I've never used Plugman. So maybe that's a data point in favor of the CLI. :-)

- 2,897
- 3
- 31
- 42
-
I think I understand it a little better now… You don’t use Cordova CLI at all for single-platform projects. You just install cordova-ios (or cordova-android) and then Plugman is the only available plugin manager. – alekop Sep 12 '21 at 00:12