Native plugins, say Camera just as one example, cannot be used with
ionic serve and that’s expected.
However that means that apps that rely on native plugins cannot be developed in the browser, something that takes away one of the main advantages of Ionic.
Some Cordova plugins at least support the
browser platform for testing. E.g. the mentioned Camera plugin provides a CameraProxy.js that uses the getUserMedia browser API to capture a picture.
Now it is possible to run in the Cordova “browser” platform (as opposed to
ionic serve where Cordova is just not defined) with
ionic platform add browser and
ionic run browser. But there’s no real advantage of doing that compared to running on Android or iOS, it’s still not the same for livereload etc. as
What’s the best approach here? Maybe Ionic Native should add browser fallback wherever possible?
The alternative is to write a new project for each functionality (like Camera), wrapping the native plugin and adding fallback browser support when Cordova is not available. That’s kind of what Ionic Storage does after all.
But this would just duplicate the “browser” support already provided by Cordova plugins. Seems like there should be a more general approach to this problem. Thoughts?