question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding plugins for only specific platforms

See original GitHub issue

Feature Request

I want to add some plugins to only single platform or skip for a certain platform. I already found a way to implement this, and I am willing to develop this feature and send a pull request if approved.

Motivation Behind Feature

Multi platform apps do not always require same functionality. For example, I may have a client who needs nfc features and use only android devices, whereas ios clients don’t need them. Besides, one may prefer not to add some specific functionality to each platform although device supports it. So why not just add the plugin and don’t implement the feature ? Short answer: to avoid unnecessary approval trouble. For example; If I add phonegap-nfc plugin, the apple approval team see that I am using nfc and ask me to prove how I use it and why I use it ? It is very hard to show what you don’t implement and the apple team will not approve it until they see a convincing explanation / proof. The issue becomes especially important when developing ad-hoc apps for customers instead of product apps that are usually same across platforms.

Feature Description

It can be implemented using cli variables that are already built in. A global variable, non conflicting variable such as “cordova-platform” can be used:

cordova plugin add some-cordova-plugin --variable cordova-platform=android cordova plugin add some-cordova-plugin --variable cordova-platform=android,browser

The command skips install steps for unspecified platforms and save preference to config.xml, so that when a platform is added/removed it can repeat the same behaviour.

Alternatives or Workarounds

It is impossible to do it without manual intervention right now. The only way is to add plugin and then delete specific folders and files which is quite cumbersome and highly repetitive.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cklamcommented, May 5, 2022

Sent from Yahoo Mail for iPhone

On Thursday, May 5, 2022, 12:39 PM, Arda Beyazoğlu @.***> wrote:

They don’t help here because plugins are already installed to the platform when they are called.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

0reactions
ardabeyazoglucommented, May 5, 2022

They don’t help here because plugins are already installed to the platform when they are called.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install plugin only in a specific platform (defined in package.json)
Many plugins do work only in a specific platform and crash in other platforms during build. Furthermore many plugins are specifically designed ...
Read more >
Install cordova plugin for ONE platform only - Stack Overflow
I've found that the only clean way to make it work is to modify 3 things: Edit the plugins/PLATFORM.js file (ex. plugins/android.js) and ......
Read more >
Platforms and Plugins Version Management - Apache Cordova
Platforms and Plugins Version Management. Cordova provides the ability to save and restore platforms and plugins. This feature allows developers to save and ......
Read more >
Developing packages & plugins - Flutter documentation
Add support for platforms in an existing plugin project; Dart platform implementations. Dart-only platform implementations; Hybrid platform implementations.
Read more >
Ionic platform add - only add specific plugins
Hello, I am trying to utilize two different versions of the same plugin in my project (one geared for Android and one for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found