How to include browser platform js files while running `ionic serve`?

Some Cordova plugins like the cordova media plugin include files like www/browser/Media.js that implement the same api that the plugin provides for use in browsers outside of Cordova (The plugin works also outside of Cordova, in regular browser apps).

If you do the following, for example, a zip file that contains the app is created and the mentioned Media.js file is correctly included in it:

ionic platform add browser
cordova plugin add
ionic build browser

However, if you want to use said file while running ionic serve, you’d have to copy it to www and include it in your index.html manually.

Is there a way to tell ionic serve about these files so they are included automatically?
If not, can someone provide suggestions on how to implement this the ionic way? I’m about to start writing a cordova plugin that needs a browser js file and i’d like to include it nicely in my ionic project.

1 Like

Hi, did you successfully get your cordova.js available in your browser then?