Guidance on Ionic PWA with cordova plugins


I have an Ionic 2 mobile app, that i am trying to convert to PWA, however i can’t find much documentation on converting a full mobile app to PWA.

For example , how do i handle cordova plugins?

  • Is there guidance on how to fail gracefully on Browser when using cordova plugins.

  • For instance, i am currently using Admob cordova plugin in my app, this works perfectly on mobile but when i test it out with PWA, i get this error

Error: Module cordova-plugin-admobpro.AdMob does not exist

  • How do i ensure the cordova plugins only work on mobile and are not built for the browser version?

  • Is there a command to strip off cordova plugins?

  • Also, i am using both the Ionic Native File Plugin and the storage plugin, what do i replace this with on browser?


The Ionic Platform module will tell you if your app is running within Cordova or not, then you can conditionally make those calls.

It would nice to so more tooling support for the ‘browser’ platform in the future.


Thanks Chris.
But how do i ensure the admob plugin for example is not giving that Module cordova-plugin-admobpro.AdMob does not exist Error

And what can i replace the plugins with?


You will need to switch to Adsense for the web version. IF you never call the AdMob code, you should not get that error.


same question any replacement for sqlite-storage,file-opner2 api in pwa