ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 654 forks source link

Explicit console output on `ionic serve` that tells users that Cordova plugins don't work #2714

Open janpio opened 7 years ago

janpio commented 7 years ago

A good portion of the problems with Ionic Native and Cordova plugin still are that users try to test and debug using ionic serve as they don't know/understand that Cordova plugins won't be available there.

Would it be possible to add an explicit console log message when running ionic serve that tells them that Ionic Native and Cordova plugins won't work there?

(Should this better be implemented in Ionic Native? (This wouldn't cover Cordova plugins) Is there a way to "recognize" ionic serve?)

imhoffd commented 7 years ago

Isn't there a console.log for a missing window.cordova in Ionic Native?

janpio commented 7 years ago

I think there are only messages on missing plugins, not that testing Cordova in browser in general will not work. Will have to check.

janpio commented 7 years ago

Did so:

util.js:60 Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
util.js:60 Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

So this happens only when a Ionic Native plugin is actually called. The wording is also not very clear (no mention that this never will work in ionic serve).

Maybe changing this would be enough and the correct solution here?

Is there actually a way to check for ionic serve? This would enable a pretty clear log to be implemented when Ionic Native is initialized in ionic serve, not only when a plugin is called.

(Which of course wouldn't solve the general Cordova plugin problem...)

imhoffd commented 7 years ago

We had hoped that it would become clear Cordova wouldn't be used after adding the ionic cordova namespace to cordova commands. Have you noticed an increased number of people confused by this? I don't want to be super verbose about everything. Just need-to-knows.

janpio commented 7 years ago

Yes, lots of new people come to the forum, complaining that their "Ionic Paypal" or "Ionic Speech Recognition" doesn't work although they got and did everything from "official documentation". During gathering information I ask how they build and run their app or if they use ionic serve - and the problem is solved. (Yesterday we had 3 or 4 of those, which is quite a lot compare to total volume.)

I thought so as well re ionic cordova, but these people actually never make the connection. The copy paste some commands to install a plugin, but never used anything more than ionic serve (or ionic upload to get it into Ionic View [1]) so don't know about it. I think somehting more explicit is needed.

([1] Similar to all the people missing that Ionic View only supports a limited set of plugins - but I will only raise this when the new Ionic View is available and its supported plugins are known and this is still a problem.)

imhoffd commented 7 years ago

I'll think about how to do this. We could detect non-default cordova plugins that are installed and then show the warning in ionic serve.